From: Chao Yu <chao2.yu@samsung.com>
To: 'Dave Chinner' <david@fromorbit.com>
Cc: fstests@vger.kernel.org
Subject: [PATCH] generic/285: fix the wrong result printed in full log
Date: Tue, 10 Nov 2015 17:52:03 +0800 [thread overview]
Message-ID: <01b701d11b9d$89404100$9bc0c300$@samsung.com> (raw)
This issue was found by testing f2fs module with generic/285, and the
related bug has already been fixed since commit 2e023174a88d ("f2fs:
avoid data offset overflow when lseeking huge file"), but forgot to fix
it in xfstest suit.
The wrong result printed is printed in log below:
10. Test a huge file for offset overflow
10.01 SEEK_HOLE expected 65536 or 0, got 65536. succ
10.02 SEEK_HOLE expected 65536 or 0, got 65536. succ
10.03 SEEK_DATA expected 0 or 0, got 0. succ
10.04 SEEK_DATA expected 1 or 1, got 1. succ
10.05 SEEK_HOLE expected 0 or 0, got 0. FAIL
10.06 SEEK_DATA expected -65536 or -65536, got -65536. succ
10.07 SEEK_DATA expected -65535 or -65535, got -65535. succ
10.08 SEEK_DATA expected -65536 or -65536, got -65536. FAIL
The result printed in the log shows that when some test cases failed, the
data we expected and got are the same that is not correct obviously.
The reason is that we cast the result from type off_t(64-bit) to type
long(32-bit) when doing huge file offset seeking tests in 32-bit machine.
This patch fixes the wrong printing issue.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
---
src/seek_sanity_test.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/seek_sanity_test.c b/src/seek_sanity_test.c
index 7cf45c0..18262c2 100644
--- a/src/seek_sanity_test.c
+++ b/src/seek_sanity_test.c
@@ -187,10 +187,10 @@ static int do_lseek(int testnum, int subtest, int fd, off_t filsz, int origin,
ret = !(errno == ENXIO);
} else {
- x = fprintf(stdout, "%02d.%02d %s expected %ld or %ld, got %ld. ",
+ x = fprintf(stdout, "%02d.%02d %s expected %lld or %lld, got %lld. ",
testnum, subtest,
(origin == SEEK_HOLE) ? "SEEK_HOLE" : "SEEK_DATA",
- (long)exp, (long)exp2, (long)pos);
+ (long long)exp, (long long)exp2, (long long)pos);
ret = !(pos == exp || pos == exp2);
}
--
2.4.2
reply other threads:[~2015-11-10 9:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='01b701d11b9d$89404100$9bc0c300$@samsung.com' \
--to=chao2.yu@samsung.com \
--cc=david@fromorbit.com \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox