]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - tools/testing/selftests/sysctl/common_tests
5 echo "== Testing sysctl behavior against ${TARGET} =="
9 echo "${ORIG}" > "${TARGET}"
14 echo "${TEST_STR}" > "${TARGET}"
21 if [ "${seen}" != "${TEST_STR}" ]; then
29 if [ ! -z ${old_strict} ]; then
30 echo ${old_strict} > ${WRITES_STRICT}
35 trap 'set_orig; rm -f "${TEST_FILE}"' EXIT
39 echo -n "Writing test file ... "
40 echo "${TEST_STR}" > "${TEST_FILE}"
41 if ! verify
"${TEST_FILE}"; then
48 echo -n "Checking sysctl is not set to test value ... "
49 if verify
"${TARGET}"; then
56 echo -n "Writing sysctl from shell ... "
58 if ! verify
"${TARGET}"; then
65 echo -n "Resetting sysctl to original value ... "
67 if verify
"${TARGET}"; then
74 echo -n "Checking write strict setting ... "
75 WRITES_STRICT
="${SYSCTL}/kernel/sysctl_writes_strict"
76 if [ ! -e ${WRITES_STRICT} ]; then
77 echo "FAIL, but skip in case of old kernel" >&2
79 old_strict
=$
(cat ${WRITES_STRICT})
80 if [ "$old_strict" = "1" ]; then
83 echo "FAIL, strict value is 0 but force to 1 to continue" >&2
84 echo "1" > ${WRITES_STRICT}
88 # Now that we've validated the sanity of "set_test" and "set_orig",
89 # we can use those functions to set starting states before running
90 # specific behavioral tests.
92 echo -n "Writing entire sysctl in single write ... "
94 dd if="${TEST_FILE}" of
="${TARGET}" bs
=4096 2>/dev
/null
95 if ! verify
"${TARGET}"; then
102 echo -n "Writing middle of sysctl after synchronized seek ... "
104 dd if="${TEST_FILE}" of
="${TARGET}" bs
=1 seek
=1 skip
=1 2>/dev
/null
105 if ! verify
"${TARGET}"; then
112 echo -n "Writing beyond end of sysctl ... "
114 dd if="${TEST_FILE}" of
="${TARGET}" bs
=20 seek
=2 2>/dev
/null
115 if verify
"${TARGET}"; then
122 echo -n "Writing sysctl with multiple long writes ... "
124 (perl
-e 'print "A" x 50;'; echo "${TEST_STR}") | \
125 dd of
="${TARGET}" bs
=50 2>/dev
/null
126 if verify
"${TARGET}"; then