From ee560d6632771c2ae06bc11777bce16536e489c1 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Wed, 19 Sep 2012 20:26:15 -0400 Subject: [PATCH] Revert "Add thread mutex deadlock checker script to tests/." This reverts commit b3c7a0769f6d11a3125693b7c8fd1ab13746ea09. It wasn't working the way I was hoping. Most of the pwmc clients weren't connecting successfully. The shell fragment below does a decent enough job although the total number of clients may need to be adjusted to avoid any "too many open files" errors: time { for i in `seq 1 1000`; do { sh -c 'echo -ne LIST | \ pwmc --quiet new >/dev/null || \ echo "pwmc error" && break &'; }; done; } & Then watch the pwmd logs for connections. The pwmc error from the original commit was a failure to connect to pwmd. I'm not sure what the cause is but the above fragment can queue 200+ connected clients depending on the cache status. I will make a better test case some other time. --- tests/common.sh | 4 +--- tests/mutexcheck.sh | 64 ----------------------------------------------------- 2 files changed, 1 insertion(+), 67 deletions(-) delete mode 100755 tests/mutexcheck.sh diff --git a/tests/common.sh b/tests/common.sh index 555c23e2..2e11a075 100644 --- a/tests/common.sh +++ b/tests/common.sh @@ -1,7 +1,6 @@ on_exit() { - set +o errexit if [ $PID ]; then - kill $PID 2> /dev/null + kill $PID fi if [ -f "gpg-agent.env" ]; then @@ -33,7 +32,6 @@ wait_for_socket() { launch_pwmd () { $PWMD --homedir $WDIR -n $@ > /dev/null & PID=$! - PWMD_PID=$PID wait_for_socket $PID socket } diff --git a/tests/mutexcheck.sh b/tests/mutexcheck.sh deleted file mode 100755 index 875e730f..00000000 --- a/tests/mutexcheck.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# -# A thread mutex deadlock checker. Note that your systems sleep(1) program -# should be able to accept floating point time arguments. -# -# Try running as: mutexcheck.sh 200 0.0 35 0.5 -# -if [ $# -ne 4 ]; then - echo "Usage: $0 total_clients delay burst_clients burst_delay" - exit 1 -fi - -TOTAL=$1 -DELAY=$2 -BCLIENTS=$3 -BDELAY=$4 -COUNT=0 - -source common.sh -source import-common.sh - -do_import list - -cat > config << EOF -[global] -log_level=9 -#enable_logging=true -[list] -passphrase_file=`pwd`/list.key -EOF - -launch_pwmd list - -while [ $COUNT -lt $TOTAL ]; do - { - n=$BCLIENTS - while [ $n -gt 0 ]; do - { - sleep $BDELAY; echo -ne 'LIST' | \ - pwmc $PWMC_ARGS --quiet list > /dev/null; - } & - - n=$(($n - 1)); - done; - } & - - COUNT=$(($COUNT + $BCLIENTS)); - echo "Forked $COUNT total clients."; - sleep $DELAY; -done - -kill $PWMD_PID - -while true; do - kill -n 0 $PWMD_PID 2>/dev/null - if [ $? -eq 0 ]; then - echo "Pwmd is still running. Press Ctrl-C to interrupt." - sleep 1 - else - break - fi -done - -on_exit -- 2.11.4.GIT