summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/sysctl/common_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/sysctl/common_tests')
-rw-r--r--tools/testing/selftests/sysctl/common_tests22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/testing/selftests/sysctl/common_tests b/tools/testing/selftests/sysctl/common_tests
index 17d534b1b7b4..b6862322962f 100644
--- a/tools/testing/selftests/sysctl/common_tests
+++ b/tools/testing/selftests/sysctl/common_tests
@@ -24,6 +24,14 @@ verify()
return 0
}
+exit_test()
+{
+ if [ ! -z ${old_strict} ]; then
+ echo ${old_strict} > ${WRITES_STRICT}
+ fi
+ exit $rc
+}
+
trap 'set_orig; rm -f "${TEST_FILE}"' EXIT
rc=0
@@ -63,6 +71,20 @@ else
echo "ok"
fi
+echo -n "Checking write strict setting ... "
+WRITES_STRICT="${SYSCTL}/kernel/sysctl_writes_strict"
+if [ ! -e ${WRITES_STRICT} ]; then
+ echo "FAIL, but skip in case of old kernel" >&2
+else
+ old_strict=$(cat ${WRITES_STRICT})
+ if [ "$old_strict" = "1" ]; then
+ echo "ok"
+ else
+ echo "FAIL, strict value is 0 but force to 1 to continue" >&2
+ echo "1" > ${WRITES_STRICT}
+ fi
+fi
+
# Now that we've validated the sanity of "set_test" and "set_orig",
# we can use those functions to set starting states before running
# specific behavioral tests.