summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2011-10-04 23:45:45 +0200
committerKarel Zak2011-10-26 23:17:17 +0200
commitc293a7e8aeaa09032faf8648f01205a30575232a (patch)
tree1ebf51bbfd14ac6d7a722aa52dcc4482b34e71f0
parentlogin: host{name,address} initialization refactoring (diff)
downloadkernel-qcow2-util-linux-c293a7e8aeaa09032faf8648f01205a30575232a.tar.gz
kernel-qcow2-util-linux-c293a7e8aeaa09032faf8648f01205a30575232a.tar.xz
kernel-qcow2-util-linux-c293a7e8aeaa09032faf8648f01205a30575232a.zip
tests: cleanup islocal test
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--login-utils/.gitignore2
-rw-r--r--login-utils/Makefile.am7
-rw-r--r--login-utils/islocal.c6
-rw-r--r--tests/commands.sh.in3
-rwxr-xr-xtests/ts/login/islocal2
5 files changed, 10 insertions, 10 deletions
diff --git a/login-utils/.gitignore b/login-utils/.gitignore
index 31af9d49c..17b6f09b9 100644
--- a/login-utils/.gitignore
+++ b/login-utils/.gitignore
@@ -1,4 +1,4 @@
-islocal_test
+test_islocal
chfn
chsh
login
diff --git a/login-utils/Makefile.am b/login-utils/Makefile.am
index a07279e1a..a5909a6f5 100644
--- a/login-utils/Makefile.am
+++ b/login-utils/Makefile.am
@@ -65,7 +65,6 @@ install-exec-hook::
endif
-noinst_PROGRAMS = islocal_test
-islocal_test_SOURCES = islocal.c
-islocal_test_CPPFLAGS = -DMAIN_TEST_ISLOCAL $(AM_CPPFLAGS)
-
+noinst_PROGRAMS = test_islocal
+test_islocal_SOURCES = islocal.c
+test_islocal_CPPFLAGS = -DTEST_PROGRAM $(AM_CPPFLAGS)
diff --git a/login-utils/islocal.c b/login-utils/islocal.c
index 39a74c6a8..e0a3d7694 100644
--- a/login-utils/islocal.c
+++ b/login-utils/islocal.c
@@ -92,12 +92,12 @@ is_local(const char *user)
}
}
-#if MAIN_TEST_ISLOCAL
+#ifdef TEST_PROGRAM
int
main (int argc, char *argv[])
{
- if (argc < 2) {
- fprintf(stderr, "No test passwd file was specified.\n");
+ if (argc <= 2) {
+ fprintf(stderr, "usage: %s <passwdfile> <username> [...]\n", argv[0]);
return 1;
} else {
int i;
diff --git a/tests/commands.sh.in b/tests/commands.sh.in
index 462a4f56b..63c146fc6 100644
--- a/tests/commands.sh.in
+++ b/tests/commands.sh.in
@@ -24,6 +24,8 @@ TS_HELPER_LIBMOUNT_UPDATE="$top_builddir/libmount/src/test_tab_update"
TS_HELPER_LIBMOUNT_CONTEXT="$top_builddir/libmount/src/test_context"
TS_HELPER_LIBMOUNT_TABDIFF="$top_builddir/libmount/src/test_tab_diff"
+TS_HELPER_ISLOCAL="$top_builddir/login-utils/test_islocal"
+
# TODO: use partx
TS_HELPER_PARTITIONS="$top_builddir/libblkid/samples/partitions"
@@ -55,7 +57,6 @@ TS_CMD_LOOK=${TS_CMD_LOOK-"$top_builddir/misc-utils/look"}
TS_CMD_CAL=${TS_CMD_CAL-"$top_builddir/misc-utils/cal"}
TS_CMD_SCRIPT=${TS_CMD_SCRIPT-"$top_builddir/term-utils/script"}
-TS_CMD_ISLOCAL=${TS_CMD_ISLOCAL-"$top_builddir/login-utils/islocal_test"}
TS_CMD_HWCLOCK=${TS_CMD_HWCLOCK-"$top_builddir/hwclock/hwclock"}
TS_CMD_LSCPU=${TS_CMD_LSCPU-"$top_builddir/sys-utils/lscpu"}
diff --git a/tests/ts/login/islocal b/tests/ts/login/islocal
index ba2385734..c25da6a07 100755
--- a/tests/ts/login/islocal
+++ b/tests/ts/login/islocal
@@ -21,7 +21,7 @@ TS_DESC="islocal"
. $TS_TOPDIR/functions.sh
ts_init "$*"
-$TS_CMD_ISLOCAL "$TS_SELF/islocal.data" root nobody "" youngman youngman2 \
+$TS_HELPER_ISLOCAL "$TS_SELF/islocal.data" root nobody "" youngman youngman2 \
abcdefghx nobo long rot al malformed \
nonl znobody >> $TS_OUTPUT
ts_finalize