From f8a9670f14f419a6ff73c5874c4d8cff4b4de5f7 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 7 Aug 2007 00:46:46 +0200 Subject: [PATCH] tests: add script(1) race condition test Signed-off-by: Karel Zak --- tests/Makefile.am | 1 + tests/commands.sh.in | 1 + tests/expected/ts-script-race | 1 + tests/ts-script-race | 37 +++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 tests/expected/ts-script-race create mode 100755 tests/ts-script-race diff --git a/tests/Makefile.am b/tests/Makefile.am index 8b354014..418b507d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 diff --git a/tests/commands.sh.in b/tests/commands.sh.in index a9572e06..5e0bb504 100644 --- a/tests/commands.sh.in +++ b/tests/commands.sh.in @@ -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 index 00000000..83b33d23 --- /dev/null +++ b/tests/expected/ts-script-race @@ -0,0 +1 @@ +1000 diff --git a/tests/ts-script-race b/tests/ts-script-race new file mode 100755 index 00000000..818d0c5e --- /dev/null +++ b/tests/ts-script-race @@ -0,0 +1,37 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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 + -- 2.39.5