testsuite fixes

This commit is contained in:
Craig Small 2011-11-23 21:44:51 +11:00
parent 618c52167b
commit 451f6e6111
6 changed files with 53 additions and 1 deletions

View File

@ -1,7 +1,7 @@
AM_CPPFLAGS = -include $(top_builddir)/config.h AM_CPPFLAGS = -include $(top_builddir)/config.h
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
SUBDIRS = proc ps SUBDIRS = proc ps testsuite
AM_CFLAGS = -Iproc AM_CFLAGS = -Iproc
AM_LDFLAGS = ./proc/libproc-ng.la AM_LDFLAGS = ./proc/libproc-ng.la

View File

@ -135,10 +135,17 @@ if test "x$enable_w_from" = xyes; then
AC_DEFINE(W_SHOWFROM, 1, [enable w from field by default]) AC_DEFINE(W_SHOWFROM, 1, [enable w from field by default])
fi fi
if test x"$DEJAGNU" = x
then
DEJAGNU="\$(top_srcdir)/testsuite/global-conf.exp"
fi
AC_SUBST(DEJAGNU)
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile
proc/Makefile proc/Makefile
proc/libproc-ng.pc proc/libproc-ng.pc
ps/Makefile ps/Makefile
testsuite/Makefile
]) ])
AC_OUTPUT AC_OUTPUT

2
testsuite/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.log
*.sum

5
testsuite/Makefile.am Normal file
View File

@ -0,0 +1,5 @@
AUTOMAKE_OPTIONS = dejagnu
export DEJAGNU
DEJATOOL = \
pwdx

View File

@ -0,0 +1,8 @@
proc pwdx_load { arg } { }
proc pwdx_exit {} {}
proc pwdx_version {} {
set tmp [ exec pwdx -V ]
regexp "procps-ng version (\[0-9.\]*)" $tmp tmp version
clone_output "pwdx version $version\n"
}

View File

@ -0,0 +1,30 @@
# Run pwdx with no arguments
set test "pwdx no args"
spawn pwdx
expect {
-re "^Usage: pwdx pid\.\.\." { pass "$test" }
eof { fail "$test" }
timeout { fail "$test" }
}
# Run pwdx with pid 1 which is not reachable
set test "pwdx pid 1 should give permission denied"
spawn pwdx 1
expect {
-re "^1: Permission denied" { pass "$test" }
eof { fail "$test" }
timeout { fail "$test" }
}
# Run pwdx with existing pid
set test "pwdx finds sleep in cwd"
set sleep_pid [ exec sleep 600 & ]
set sleep_pwd [ pwd ]
spawn pwdx $sleep_pid
expect {
-re "^$sleep_pid: $sleep_pwd" { pass "$test" }
eof { fail "$test" }
timeout { fail "$test" }
}