xref: /freebsd/tools/test/stress2/tools/setup.sh (revision 4d846d26)
1#!/bin/sh
2
3# Create the local configuration file.
4
5[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
6
7allconfig=${allconfig:-/tmp/stress2.d/`hostname`}
8[ -f $allconfig ] && grep -q "^testuser" $allconfig && exit 0
9set -e
10echo -n "Enter non-root test user name: "
11read testuser
12id $testuser > /dev/null 2>&1 ||
13    { echo "User \"$testuser\" not found."; exit 1; }
14[ $testuser ] || exit 1
15su $testuser -c 'echo Hello' 2>&1 | grep -qE '^Hello$' ||
16    { echo "User \"$testuser\" not usable."; exit 1; }
17mkdir -p `dirname $allconfig`
18(
19	echo '# Local stress2 config file'
20	echo '# Overwrite default values in stress2/default.cfg'
21	echo
22	echo '# nfs_export=${nfs_export:-t1:/tmp}'
23	echo '# BLASTHOST=${BLASTHOST:-t1}'
24	echo '# RUNDIR=${RUNDIR:-/work/stressX}'
25	echo '# diskimage=${diskimage:-/work/diskfile}'
26 	echo
27	echo "testuser=$testuser"
28) >> $allconfig
29cat > `dirname $allconfig`/README <<EOF
30The /tmp/stress2.d directory contain the following files:
31
32bench.sh.log	Performance info for the bench.sh test
33elapsed		The runtime for each test
34excessive	Test that ran for more than 30 minutes
35all.exclude	Local list of tests to exclude, one test per line starting in column one
36fail		List of the failed test
37last		Last test run
38list		Current list of tests to run
39log		List of test run
40output		Output from the last test run
41`hostname`	Local configuration file
42vmstat		Memory leak report
43EOF
44[ -f README ] && echo && cat README
45exit 0
46