From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] utimensat_tests.sh: returns EPERM on 4.4.27 and above
Date: Mon, 25 Sep 2017 16:46:24 +0200 [thread overview]
Message-ID: <20170925144624.GB31931@rei> (raw)
In-Reply-To: <CAO_48GG9k_MxhktOWptCkv1Y8xFfFN31w2ntcnkZL5LdhM7qxg@mail.gmail.com>
Hi!
> I'd think so too - perhaps a better check is to check for (if 4.4.X,
> then if > .27) OR (greater than 4.8.0)?
The safest bet would be allowing both for kernels between 4.4 and 4.8.
Something like this may work (beware untested):
diff --git a/testcases/kernel/syscalls/utimensat/utimensat_tests.sh b/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
index 48154d6e6..41ea7997a 100755
--- a/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
+++ b/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
@@ -31,13 +31,18 @@ if tst_kvcmp -lt "2.6.22"; then
fi
# Starting with 4.8.0 operations on immutable files return EPERM instead of
-# EACCES.
-if tst_kvcmp -lt "4.8.0"; then
+# EACCES. The patch that changed the errno got as well backported to stable
+# kernel branches and so we cannot really say what is correct for kernels in
+# the range between 4.4 and 4.8.
+imaccess="EACCES EPERM"
+
+if tst_kvcmp -lt "4.4"; then
imaccess=EACCES
-else
- imaccess=EPERM
fi
+if tst_kvcmp -ge "4.8"; then
+ imaccess=EPERM
+fi
RESULT_FILE=$TMPDIR/utimensat.result
@@ -142,7 +147,13 @@ check_result()
"$EXPECT_MTIME_CHANGED"
echo "RESULT: $res $atime $mtime"
- if test "$res" != "$EXPECTED_RESULT"; then
+ for err in $EXPECTED_RESULT; do
+ if test "$res" = "$err"; then
+ errno_found="$err";
+ fi
+ done
+
+ if test -z "$errno_found"; then
test_failed
return
fi
@@ -223,7 +234,7 @@ run_test()
CMD="./$TEST_PROG -q $FILE $4"
echo "$CMD"
sudo $s_arg -u $test_user $CMD > $RESULT_FILE
- check_result $? $5 $6 $7
+ check_result $? "$5" $6 $7
echo
if test $do_read_fd_test -ne 0; then
@@ -232,7 +243,7 @@ run_test()
CMD="./$TEST_PROG -q -d $FILE NULL $4"
echo "$CMD"
sudo $s_arg -u $test_user $CMD > $RESULT_FILE
- check_result $? $5 $6 $7
+ check_result $? "$5" $6 $7
echo
fi
@@ -245,7 +256,7 @@ run_test()
CMD="./$TEST_PROG -q -w -d $FILE NULL $4"
echo "$CMD"
sudo $s_arg -u $test_user $CMD > $RESULT_FILE
- check_result $? $5 $6 $7
+ check_result $? "$5" $6 $7
echo
fi
@@ -424,10 +435,10 @@ echo "Testing immutable file, owned by self"
echo
echo "***** Testing times==NULL case *****"
-run_test -W "" 600 "+i" "" $imaccess
+run_test -W "" 600 "+i" "" "$imaccess"
echo "***** Testing times=={ UTIME_NOW, UTIME_NOW } case *****"
-run_test -W "" 600 "+i" "0 n 0 n" $imaccess
+run_test -W "" 600 "+i" "0 n 0 n" "$imaccess"
echo "***** Testing times=={ UTIME_OMIT, UTIME_OMIT } case *****"
run_test -W "" 600 "+i" "0 o 0 o" SUCCESS n n
@@ -450,10 +461,10 @@ echo "Testing immutable append-only file, owned by self"
echo
echo "***** Testing times==NULL case *****"
-run_test -W "" 600 "+ai" "" $imaccess
+run_test -W "" 600 "+ai" "" "$imaccess"
echo "***** Testing times=={ UTIME_NOW, UTIME_NOW } case *****"
-run_test -W "" 600 "+ai" "0 n 0 n" $imaccess
+run_test -W "" 600 "+ai" "0 n 0 n" "$imaccess"
echo "***** Testing times=={ UTIME_OMIT, UTIME_OMIT } case *****"
run_test -W "" 600 "+ai" "0 o 0 o" SUCCESS n n
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2017-09-25 14:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 11:30 [LTP] [PATCH] utimensat_tests.sh: returns EPERM on 4.4.27 and above naresh.kamboju
2017-09-06 11:54 ` Jan Stancek
2017-09-06 15:29 ` Sumit Semwal
2017-09-25 14:46 ` Cyril Hrubis [this message]
2017-09-27 11:39 ` Cyril Hrubis
2017-09-27 13:55 ` Jan Stancek
2017-09-27 15:12 ` Cyril Hrubis
2017-09-27 22:38 ` Naresh Kamboju
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=20170925144624.GB31931@rei \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.