Current test expects test_lower to fail with:
truncate(test_lower) should have failed
While it is sort of okay to fail like that (the above expectation
basically acknowledges this weirdness in the overlayfs
implementation), it is by no means the only correct behavior: it is
also correct for the test to succeed (i.e. truncation fails with
ETXTBSY).
So add an option to t_truncate_self.c that allows both success and
failure, but obviously not SIGSEGV, which is what a we'd get in a
real failure mode.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
#include <stdio.h>
+#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <libgen.h>
ret = truncate(argv[0], 4096);
if (ret != -1) {
+ if (argc == 2 && strcmp(argv[1], "--may-succeed") == 0)
+ return 0;
fprintf(stderr, "truncate(%s) should have failed\n",
progname);
return 1;
# run test program from lower and upper dir
# test programs truncate themselfs, all should fail with ETXTBSY
-$SCRATCH_MNT/test_lower
+$SCRATCH_MNT/test_lower --may-succeed
$SCRATCH_MNT/test_upper
# success, all done
+echo "Silence is golden"
status=0
exit
QA output created by 013
-truncate(test_lower) should have failed
+Silence is golden