From 82eafe3fe85073c1ab682c23edec0ff27e464b3d Mon Sep 17 00:00:00 2001 From: Craig Small Date: Wed, 23 Nov 2011 22:48:49 +1100 Subject: [PATCH] new free commands --- testsuite/.gitignore | 2 ++ testsuite/Makefile.am | 2 +- testsuite/config/unix.exp | 33 ++++++++++++++++++- testsuite/global-conf.exp | 0 testsuite/procps-ng.test/free.test/free.exp | 9 +++++ .../{ => procps-ng.test}/pwdx.test/pwdx.exp | 1 + 6 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 testsuite/global-conf.exp create mode 100644 testsuite/procps-ng.test/free.test/free.exp rename testsuite/{ => procps-ng.test}/pwdx.test/pwdx.exp (96%) diff --git a/testsuite/.gitignore b/testsuite/.gitignore index 1e6f9352..96ef0306 100644 --- a/testsuite/.gitignore +++ b/testsuite/.gitignore @@ -1,2 +1,4 @@ *.log *.sum +site.bak +site.exp diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index dc57c450..e0f2bc00 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -2,4 +2,4 @@ AUTOMAKE_OPTIONS = dejagnu export DEJAGNU DEJATOOL = \ - pwdx + procps-ng diff --git a/testsuite/config/unix.exp b/testsuite/config/unix.exp index d329d7ec..c0dac447 100644 --- a/testsuite/config/unix.exp +++ b/testsuite/config/unix.exp @@ -1,8 +1,39 @@ +regexp "(.*\/)testsuite" $objdir objdir topdir + proc pwdx_load { arg } { } proc pwdx_exit {} {} proc pwdx_version {} { + global topdir set tmp [ exec pwdx -V ] regexp "procps-ng version (\[0-9.\]*)" $tmp tmp version - clone_output "pwdx version $version\n" + clone_output "${topdir}pwdx version $version\n" +} + +# free functions +proc free_load { arg } { } +proc free_exit {} {} +proc free_version {} { + set tmp [ exec free --version ] + regexp "procps-ng version (\[0-9.\]*)" $tmp tmp version + clone_output "free version $version\n" +} + +# +# +# common utilities +proc expect_continue { testname reg } { + expect { + -re "$reg" { } + eof { fail "$testname" } + timeout { fail "$testname" } + } +} + +proc expect_pass { testname reg } { + expect { + -re "$reg" { pass "$testname" } + eof { fail "$testname" } + timeout { fail "$testname" } + } } diff --git a/testsuite/global-conf.exp b/testsuite/global-conf.exp new file mode 100644 index 00000000..e69de29b diff --git a/testsuite/procps-ng.test/free.test/free.exp b/testsuite/procps-ng.test/free.test/free.exp new file mode 100644 index 00000000..a5f251f5 --- /dev/null +++ b/testsuite/procps-ng.test/free.test/free.exp @@ -0,0 +1,9 @@ +# +# Testsuite for free program +# + +set free "${topdir}free" +set test "free with no arguments" +spawn free +expect_pass "$test" "^\\s+total\\s+used\\s+free\\s+shared\\s+buffers\\s+cached\\s*Mem:\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*-\\/\\+ buffers\\/cache:\\s+\\d+\\s+\\d+\\s*Swap:\\s+\\d+\\s+\\d+\\s+\\d+" + diff --git a/testsuite/pwdx.test/pwdx.exp b/testsuite/procps-ng.test/pwdx.test/pwdx.exp similarity index 96% rename from testsuite/pwdx.test/pwdx.exp rename to testsuite/procps-ng.test/pwdx.test/pwdx.exp index cd60c211..7f830372 100644 --- a/testsuite/pwdx.test/pwdx.exp +++ b/testsuite/procps-ng.test/pwdx.test/pwdx.exp @@ -1,4 +1,5 @@ +set pwdx "${topdir}pwdx" # Run pwdx with no arguments set test "pwdx no args" spawn pwdx -- 2.40.0