1#!/bin/sh 2# description: Test creation and deletion of trace instances 3 4if [ ! -d instances ] ; then 5 echo "no instance directory with this kernel" 6 exit_unsupported; 7fi 8 9fail() { # mesg 10 rmdir x y z 2>/dev/null 11 echo $1 12 set -e 13 exit $FAIL 14} 15 16cd instances 17 18# we don't want to fail on error 19set +e 20 21mkdir x 22rmdir x 23result=$? 24 25if [ $result -ne 0 ]; then 26 echo "instance rmdir not supported" 27 exit_unsupported 28fi 29 30instance_slam() { 31 while :; do 32 mkdir x 33 mkdir y 34 mkdir z 35 rmdir x 36 rmdir y 37 rmdir z 38 done 2>/dev/null 39} 40 41instance_slam & 42p1=$! 43echo $p1 44 45instance_slam & 46p2=$! 47echo $p2 48 49instance_slam & 50p3=$! 51echo $p3 52 53instance_slam & 54p4=$! 55echo $p4 56 57instance_slam & 58p5=$! 59echo $p5 60 61ls -lR >/dev/null 62sleep 1 63 64kill -1 $p1 65kill -1 $p2 66kill -1 $p3 67kill -1 $p4 68kill -1 $p5 69 70echo "Wait for processes to finish" 71wait $p1 $p2 $p3 $p4 $p5 72echo "all processes finished, wait for cleanup" 73 74mkdir x y z 75ls x y z 76rmdir x y z 77for d in x y z; do 78 if [ -d $d ]; then 79 fail "instance $d still exists" 80 fi 81done 82 83set -e 84 85exit 0 86