]> err.no Git - util-linux/commitdiff
tests: add script(1) race condition test
authorKarel Zak <kzak@redhat.com>
Mon, 6 Aug 2007 22:46:46 +0000 (00:46 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 6 Aug 2007 22:46:46 +0000 (00:46 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/Makefile.am
tests/commands.sh.in
tests/expected/ts-script-race [new file with mode: 0644]
tests/ts-script-race [new file with mode: 0755]

index 8b3540146501a63837932c13313c7f2bdc8263d7..418b507d001e2ea8f3b2c4d3d9f28ddf2b9c85f0 100644 (file)
@@ -38,6 +38,7 @@ EXTRA_DIST =  expected \
                ts-mount-special \
                ts-mount-uuid \
                ts-namei-logic \
+               ts-script-race \
                ts-swapon-devname \
                ts-swapon-label \
                ts-swapon-uuid
index a9572e062d9e6d29f4629365097dbe35c9d229aa..5e0bb5041ceedef5aca28214b0d559019e990c07 100644 (file)
@@ -33,6 +33,7 @@ TS_CMD_NAMEI=${TS_CMD_NAMEI-"$TOPDIR/misc-utils/namei"}
 TS_CMD_LOOK=${TS_CMD_LOOK-"$TOPDIR/misc-utils/look"}
 TS_CMD_CAL=${TS_CMD_CAL-"$TOPDIR/misc-utils/cal"}
 TS_CMD_CALTEST=${TS_CMD_CALTEST-"$TOPDIR/misc-utils/cal_test"}
+TS_CMD_SCRIPT=${TS_CMD_SCRIPT-"$TOPDIR/misc-utils/script"}
 
 TS_CMD_CHECKTTY=${TS_CMD_CHECKTTY-"$TOPDIR/login-utils/checktty_test"}
 
diff --git a/tests/expected/ts-script-race b/tests/expected/ts-script-race
new file mode 100644 (file)
index 0000000..83b33d2
--- /dev/null
@@ -0,0 +1 @@
+1000
diff --git a/tests/ts-script-race b/tests/ts-script-race
new file mode 100755 (executable)
index 0000000..818d0c5
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux-ng.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+. ./commands.sh
+. ./functions.sh
+
+TS_COMPONENT="script"
+TS_DESC="race conditions"
+
+ts_init "$*"
+
+bingofile="$TS_OUTDIR/$TS_NAME-bingo"
+
+set -o pipefail
+
+for i in `seq 1 1000`; do
+       $TS_CMD_SCRIPT -q -c "printf 'Bingo\n'" $bingofile
+done | grep -c Bingo >> $TS_OUTPUT
+
+rm -f $bingofile
+
+ts_finalize
+