aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-containers/lxc/files/run-ptest
blob: 196adb04407ff139f1dc7aa5e3e3a189e9254c12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash

# Network interfaces come up and down and can be quite noisy
# and since we are often on the console when running ptests
# let's just quiet things some
dmesg -n 1

# Blacklisted test will be skipped
blacklist=""
# Not applicable
blacklist="$blacklist lxc-test-apparmor"
blacklist="$blacklist lxc-test-apparmor-mount"
#lxc-test-get_item would report Built without AppArmor support error
blacklist="$blacklist lxc-test-get_item"
# These currently hang so skip them until someone fixes them up
blacklist="$blacklist lxc-test-shutdowntest"
blacklist="$blacklist lxc-test-state-server"

# Tests in firstrunlist will be run first
firstrunlist=""
firstrunlist="$firstrunlist lxc-test-unpriv"

passed=0
failed=0
skipped=0

# Create logs dir and clear old logs if any
mkdir logs 2> /dev/null
rm -f logs/*

echo "### Starting LXC ptest ###"

for test in $firstrunlist
do
	./tests/$test >logs/$(basename $test).log 2>&1
	if [ $? -eq 0 ]
	then
		echo "PASS: $(basename $test)"
		passed=$((passed+1))
	else
		echo "FAIL: $(basename $test)"
		failed=$((failed+1))
	fi
done

for test in ./tests/*
do
    if [[ ! $blacklist = *$(basename $test)*  ]]
    then
	if [[ ! $firstrunlist = *$(basename $test)* ]]
	then
		$test >logs/$(basename $test).log 2>&1
	else
		continue;
	fi
    else
	echo "SKIPPED: $(basename $test)"
	skipped=$((skipped+1))
	continue
    fi

    if [ $? -eq 0 ]
    then
	echo "PASS: $(basename $test)"
	passed=$((passed+1))
    else
	echo "FAIL: $(basename $test)"
	failed=$((failed+1))
    fi
done


echo ""
echo "Results:"
echo "    PASSED = $passed"
echo "    FAILED = $failed"
echo "    SKIPPED = $skipped"
echo "(for details check individual test log in ./logs directory)"
echo ""
echo "### LXC ptest complete ###"

# restore dmesg to console
dmesg -n 6