2011-11-28 16:32:27 +05:30
|
|
|
#
|
|
|
|
# Dejagnu tests for sysctl (read only) - part of procps
|
|
|
|
#
|
2022-08-29 14:43:10 +05:30
|
|
|
set sysctl ${topdir}src/sysctl
|
2011-11-28 16:32:27 +05:30
|
|
|
set hostname [ exec cat "/proc/sys/kernel/hostname" ]
|
|
|
|
|
|
|
|
set test "sysctl with no arguments"
|
|
|
|
spawn $sysctl
|
2012-01-02 12:09:41 +05:30
|
|
|
expect_pass "$test" "^\\s+Usage:\\s+\(lt-\)?sysctl \\\[options\\\] \\\[variable\\\[=value\\\] \.\.\.\\\]"
|
2011-11-28 16:32:27 +05:30
|
|
|
|
|
|
|
set test "sysctl reading a variable using slash delimiter"
|
|
|
|
spawn $sysctl kernel/hostname
|
|
|
|
expect_pass "$test" "kernel.hostname = ${hostname}"
|
|
|
|
|
|
|
|
set test "sysctl reading a variable using dot delimiter"
|
|
|
|
spawn $sysctl kernel.hostname
|
|
|
|
expect_pass "$test" "kernel.hostname = ${hostname}"
|
|
|
|
|
|
|
|
set test "sysctl reading a variable suppress key"
|
|
|
|
spawn $sysctl -n kernel.hostname
|
|
|
|
expect_pass "$test" "${hostname}"
|
|
|
|
|
|
|
|
set test "sysctl reading a variable suppress value"
|
|
|
|
spawn $sysctl -N kernel.hostname
|
|
|
|
expect_pass "$test" "kernel.hostname"
|
2021-07-20 18:15:17 +05:30
|
|
|
|
|
|
|
set test "sysctl reading using a path traversal"
|
|
|
|
spawn $sysctl /../../etc/passwd
|
|
|
|
expect_pass "$test" "sysctl: Path is not under /proc/sys/: /proc/sys//../../etc/passwd"
|