From: Karel Zak Date: Mon, 6 Aug 2007 22:46:46 +0000 (+0200) Subject: tests: add script(1) race condition test X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8a9670f14f419a6ff73c5874c4d8cff4b4de5f7;p=util-linux tests: add script(1) race condition test Signed-off-by: Karel Zak --- 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 +