I am currently working on a bigger project where i want to test executable file with few different codes as input.
I call it like this ./test < code1
and after command echo $?
, it shows last returned value [0, 1, 2, ..]
I wanted to automate is, so i created call in makefile
like this :
#makefile
[...]
test :
./test < code1
@echo $$?
./test < code2
@echo $$?
[...]
[...]
So i can call make test
.
When program returns 0 as success, everything works fine. But when program has to return something else than 0, it shows me this :
./test < code3
Makefile:19: recipe for target 'test' failed
make: *** [test[ Error 2
Weird thing is, when i try to call program with code which made it crash in command line like :
./test < code3; echo $?
It works perfectly and shows me last exit status ( for exapmle 3 ).
I am confused now, because i thought it should work the same. Can someone help me out?
Thank you!
See this answer: https://stackoverflow.com/a/41452754/939557
You need to put the echo
into the same logical line as your test invocation:
test :
./test < code1; echo $$?
./test < code2; echo $$?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.