Update free testsuite
free got a makeover to suit the newer kernel memory management. This commit updates the tests to follow the new output for free Signed-off-by: Craig Small <csmall@enc.com.au>
This commit is contained in:
parent
8adf4acc03
commit
12f13f9fc2
@ -7,24 +7,24 @@ set meminfo [ exec cat /proc/meminfo ]
|
||||
regexp "MemTotal:\\s+\(\\d+\)" $meminfo -> memtotal_kb
|
||||
regexp "SwapTotal:\\s+\(\\d+\)" $meminfo -> swaptotal_kb
|
||||
|
||||
set free_header "\\s+total\\s+used\\s+free\\s+shared\\s+buffers\\s+cached\\s*"
|
||||
set free_header "\\s+total\\s+used\\s+free\\s+shared\\s+buff\\/cache\\s+available\\s*"
|
||||
|
||||
set test "free with no arguments"
|
||||
spawn $free
|
||||
expect_pass "$test" "^${free_header}Mem:\\s+${memtotal_kb}\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*-\\/\\+ buffers\\/cache:\\s+\\d+\\s+\\d+\\s*Swap:\\s+${swaptotal_kb}\\s+\\d+\\s+\\d+\\s*"
|
||||
expect_pass "$test" "^${free_header}Mem:\\s+${memtotal_kb}\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*Swap:\\s+${swaptotal_kb}\\s+\\d+\\s+\\d+\\s*"
|
||||
|
||||
set test "free with -b argument"
|
||||
set memtotal [ expr { $memtotal_kb * 1024 } ]
|
||||
set swaptotal [ expr { $swaptotal_kb * 1024 } ]
|
||||
spawn $free -b
|
||||
expect_pass "$test" "^${free_header}Mem:\\s+${memtotal}\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*-\\/\\+ buffers\\/cache:\\s+\\d+\\s+\\d+\\s*Swap:\\s+${swaptotal}\\s+\\d+\\s+\\d+\\s*"
|
||||
expect_pass "$test" "^${free_header}Mem:\\s+${memtotal}\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*Swap:\\s+${swaptotal}\\s+\\d+\\s+\\d+\\s*"
|
||||
|
||||
foreach {arg divisor } {-k 1 -m 1024 -g 1048576 } {
|
||||
set test "free with $arg argument"
|
||||
set memtotal [ expr { $memtotal_kb / $divisor } ]
|
||||
set swaptotal [ expr { $swaptotal_kb / $divisor } ]
|
||||
spawn $free $arg
|
||||
expect_pass "$test" "^${free_header}Mem:\\s+$memtotal\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*-\\/\\+ buffers\\/cache:\\s+\\d+\\s+\\d+\\s*Swap:\\s+${swaptotal}\\s+\\d+\\s+\\d+\\s*"
|
||||
expect_pass "$test" "^${free_header}Mem:\\s+$memtotal\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*Swap:\\s+${swaptotal}\\s+\\d+\\s+\\d+\\s*"
|
||||
}
|
||||
|
||||
#set test "free with human readable output"
|
||||
@ -33,15 +33,11 @@ foreach {arg divisor } {-k 1 -m 1024 -g 1048576 } {
|
||||
|
||||
set test "free with lo and hi memory statistics"
|
||||
spawn $free -l
|
||||
expect_pass "$test" "^${free_header}Mem:\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*Low:\\s+\\d+\\s+\\d+\\s+\\d+\\s*High:\\s+\\d+\\s+\\d+\\s+\\d+\\s*-\\/\\+ buffers\\/cache:\\s+\\d+\\s+\\d+\\s*Swap:\\s+\\d+\\s+\\d+\\s+\\d+"
|
||||
|
||||
set test "free old argument"
|
||||
spawn $free -o
|
||||
expect_pass "$test" "^${free_header}Mem:\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*Swap:\\s+\\d+\\s+\\d+\\s+\\d+"
|
||||
expect_pass "$test" "^${free_header}Mem:\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*Low:\\s+\\d+\\s+\\d+\\s+\\d+\\s*High:\\s+\\d+\\s+\\d+\\s+\\d+\\s*Swap:\\s+\\d+\\s+\\d+\\s+\\d+"
|
||||
|
||||
set test "free with total"
|
||||
spawn $free -t
|
||||
expect_pass "$test" "^${free_header}Mem:\\s+${memtotal_kb}\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*-\\/\\+ buffers\\/cache:\\s+\\d+\\s+\\d+\\s*Swap:\\s+${swaptotal_kb}\\s+\\d+\\s+\\d+\\s*Total:\\s+\\d+\\s+\\d+\\s+\\d+\\s*"
|
||||
expect_pass "$test" "^${free_header}Mem:\\s+${memtotal_kb}\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*Swap:\\s+${swaptotal_kb}\\s+\\d+\\s+\\d+\\s*Total:\\s+\\d+\\s+\\d+\\s+\\d+\\s*"
|
||||
|
||||
set test "free with negative repeat count"
|
||||
spawn $free -c -2
|
||||
|
Loading…
Reference in New Issue
Block a user