brintos

brintos / linux-shallow public Read only

0
0
Text · 1016 B · 607521d Raw
83 lines · plain
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.03# description: Test creation and deletion of trace instances4# requires: instances5 6fail() { # mesg7    rmdir x y z 2>/dev/null8    echo $19    set -e10    exit_fail11}12 13cd instances14 15# we don't want to fail on error16set +e17 18mkdir x19rmdir x20result=$?21 22if [ $result -ne 0 ]; then23    echo "instance rmdir not supported"24    exit_unsupported25fi26 27instance_slam() {28    while :; do29	mkdir x30	mkdir y31	mkdir z32	rmdir x33	rmdir y34	rmdir z35    done 2>/dev/null36}37 38instance_slam &39p1=$!40echo $p141 42instance_slam &43p2=$!44echo $p245 46instance_slam &47p3=$!48echo $p349 50instance_slam &51p4=$!52echo $p453 54instance_slam &55p5=$!56echo $p557 58ls -lR >/dev/null59sleep 160 61kill -1 $p162kill -1 $p263kill -1 $p364kill -1 $p465kill -1 $p566 67echo "Wait for processes to finish"68wait $p1 $p2 $p3 $p4 $p569echo "all processes finished, wait for cleanup"70 71mkdir x y z72ls x y z73rmdir x y z74for d in x y z; do75        if [ -d $d ]; then76                fail "instance $d still exists"77        fi78done79 80set -e81 82exit 083