mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
compel: Fix infect test to not override failures
Signed-off-by: Younes Manton <ymanton@ca.ibm.com> return zero on chk success Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Co-authored-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This commit is contained in:
parent
461fa72715
commit
556ab0deaf
1 changed files with 13 additions and 11 deletions
|
|
@ -94,15 +94,15 @@ static inline int chk(int fd, int val)
|
|||
int v = 0;
|
||||
|
||||
if (read(fd, &v, sizeof(v)) != sizeof(v))
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
printf("%d, want %d\n", v, val);
|
||||
return v == val;
|
||||
return v != val;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int p_in[2], p_out[2], p_err[2], pid, i, pass = 1;
|
||||
int p_in[2], p_out[2], p_err[2], pid, i, err = 0;
|
||||
|
||||
/*
|
||||
* Prepare IO-s and fork the victim binary
|
||||
|
|
@ -142,9 +142,11 @@ int main(int argc, char **argv)
|
|||
return 1;
|
||||
|
||||
printf("Checking the victim alive\n");
|
||||
pass = chk(p_out[0], 1);
|
||||
pass = chk(p_out[0], 42);
|
||||
if (!pass)
|
||||
err = chk(p_out[0], 1);
|
||||
if (err)
|
||||
return 1;
|
||||
err = chk(p_out[0], 42);
|
||||
if (err)
|
||||
return 1;
|
||||
|
||||
/*
|
||||
|
|
@ -176,14 +178,14 @@ int main(int argc, char **argv)
|
|||
printf("Checking the result\n");
|
||||
|
||||
/* These two came from parasite */
|
||||
pass = chk(p_out[0], 138);
|
||||
pass = chk(p_out[0], 403);
|
||||
err = chk(p_out[0], 138);
|
||||
err |= chk(p_out[0], 403);
|
||||
|
||||
/* These two came from post-infect */
|
||||
pass = chk(p_out[0], 1234);
|
||||
pass = chk(p_out[0], 4096);
|
||||
err |= chk(p_out[0], 1234);
|
||||
err |= chk(p_out[0], 4096);
|
||||
|
||||
if (pass)
|
||||
if (!err)
|
||||
printf("All OK\n");
|
||||
else
|
||||
printf("Something went WRONG\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue