I'm currently writing an assignment that requires adding new system calls to the kernel, and I've encountered a weird problem when writing system calls tests in C.
In one of the tests, I compare a return value from a system call to the value 1, and the if statement fails even though the syscall returns 1.
The MACRO that's used for comparison:
#define CHECK(expr,expected) \
if ((expected) !=(expr)) {\
printf("\nCheck failed (%s:%d).\n", __FILE__, __LINE__); \
printf("Expected: %d, got: %d\n", expected, expr);\
test_failed = 1; \
}
The line that fails from the test:
CHECK(unblock_program(strings[PROG_A], lengths[PROG_A]), 1);
I'm running the test on linux-2.4.18-14.