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