AM_CPPFLAGS = -include $(top_builddir)/config.h
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = proc ps
+SUBDIRS = proc ps testsuite
AM_CFLAGS = -Iproc
AM_LDFLAGS = ./proc/libproc-ng.la
AC_DEFINE(W_SHOWFROM, 1, [enable w from field by default])
fi
+if test x"$DEJAGNU" = x
+then
+ DEJAGNU="\$(top_srcdir)/testsuite/global-conf.exp"
+fi
+AC_SUBST(DEJAGNU)
+
AC_CONFIG_FILES([
Makefile
proc/Makefile
proc/libproc-ng.pc
ps/Makefile
+testsuite/Makefile
])
AC_OUTPUT
--- /dev/null
+
+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"
+}
--- /dev/null
+
+# 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" }
+}
+