55
55
# Display something before the first test output
56
56
echo "[$target] Starting tests..."
59
if time -o $TIMING vagrant ssh $target -c 'cd src/checkbox-gui; make distclean; qmake && make' >vagrant-logs/$target.checkbox-gui.log 2>vagrant-logs/$target.checkbox-gui.err; then
60
echo "[$target] Checkbox GUI build: $PASS"
63
echo "[$target] Checkbox GUI build: $FAIL"
64
echo "[$target] stdout: $(pastebinit vagrant-logs/$target.checkbox-gui.log)"
65
echo "[$target] stderr: $(pastebinit vagrant-logs/$target.checkbox-gui.err)"
67
cat $TIMING | sed -e "s/^/[$target] (timing) /"
69
# Refresh plainbox installation. This is needed if .egg-info (which is
70
# essential for 'develop' to work) was removed in the meantime, for
72
if ! time -o $TIMING vagrant ssh $target -c 'cd src/plainbox && python3 setup.py egg_info' >vagrant-logs/$target.egginfo.log 2>vagrant-logs/$target.egginfo.err; then
74
echo "[$target] Running 'plainbox/setup.py egg_info' failed"
75
echo "[$target] stdout: $(pastebinit vagrant-logs/$target.egginfo.log)"
76
echo "[$target] stderr: $(pastebinit vagrant-logs/$target.egginfo.err)"
77
echo "[$target] NOTE: unable to execute tests, marked as failed"
79
cat $TIMING | sed -e "s/^/[$target] (timing) /"
81
# Run plainbox unit tests
82
# TODO: It would be nice to support fast failing here
83
if time -o $TIMING vagrant ssh $target -c 'cd src/plainbox && python3 setup.py test' >vagrant-logs/$target.plainbox.log 2>vagrant-logs/$target.plainbox.err; then
84
echo "[$target] PlainBox test suite: $PASS"
87
echo "[$target] PlainBox test suite: $FAIL"
88
echo "[$target] stdout: $(pastebinit vagrant-logs/$target.plainbox.log)"
89
echo "[$target] stderr: $(pastebinit vagrant-logs/$target.plainbox.err)"
91
cat $TIMING | sed -e "s/^/[$target] (timing) /"
93
# Build plainbox documentation
94
if time -o $TIMING vagrant ssh $target -c 'cd src/plainbox && python3 setup.py build_sphinx' >vagrant-logs/$target.sphinx.log 2>vagrant-logs/$target.sphinx.err; then
95
echo "[$target] PlainBox documentation build: $PASS"
98
echo "[$target] PlainBox documentation build: $FAIL"
99
echo "[$target] stdout: $(pastebinit vagrant-logs/$target.sphinx.log)"
100
echo "[$target] stderr: $(pastebinit vagrant-logs/$target.sphinx.err)"
102
cat $TIMING | sed -e "s/^/[$target] (timing) /"
104
# Run checkbox-ng unit tests
105
if time -o $TIMING vagrant ssh $target -c 'cd src/checkbox-ng && python3 setup.py test' >vagrant-logs/$target.checkbox-ng.log 2>vagrant-logs/$target.checkbox-ng.err; then
106
echo "[$target] CheckBoxNG test suite: $PASS"
109
echo "[$target] CheckBoxNG test suite: $FAIL"
110
echo "[$target] stdout: $(pastebinit vagrant-logs/$target.checkbox-ng.log)"
111
echo "[$target] stderr: $(pastebinit vagrant-logs/$target.checkbox-ng.err)"
113
cat $TIMING | sed -e "s/^/[$target] (timing) /"
115
# Run plainbox integration test suite (that tests checkbox scripts)
116
if time -o $TIMING vagrant ssh $target -c 'sudo plainbox self-test --verbose --fail-fast --integration-tests' >vagrant-logs/$target.self-test.log 2>vagrant-logs/$target.self-test.err; then
117
echo "[$target] Integration tests: $PASS"
120
echo "[$target] Integration tests: $FAIL"
121
echo "[$target] stdout: $(pastebinit vagrant-logs/$target.self-test.log)"
122
echo "[$target] stderr: $(pastebinit vagrant-logs/$target.self-test.err)"
124
cat $TIMING | sed -e "s/^/[$target] (timing) /"
126
# Validate the resource provider
127
if time -o $TIMING vagrant ssh $target -c 'cd src/providers/plainbox-provider-resource-generic && ./manage.py validate' >vagrant-logs/$target.resource.log 2>vagrant-logs/$target.resource.err; then
128
echo "[$target] Resource provider: $PASS"
131
echo "[$target] Resource provider: $FAIL"
132
echo "[$target] stdout: $(pastebinit vagrant-logs/$target.resource.log)"
133
echo "[$target] stderr: $(pastebinit vagrant-logs/$target.resource.err)"
135
cat $TIMING | sed -e "s/^/[$target] (timing) /"
137
# Validate the checkbox provider
138
if time -o $TIMING vagrant ssh $target -c 'cd src/providers/plainbox-provider-checkbox && ./manage.py validate' >vagrant-logs/$target.checkbox-provider.log 2>vagrant-logs/$target.checkbox-provider.err; then
139
echo "[$target] Checkbox provider: $PASS"
142
echo "[$target] Checkbox provider: $FAIL"
143
echo "[$target] stdout: $(pastebinit vagrant-logs/$target.checkbox-provider.log)"
144
echo "[$target] stderr: $(pastebinit vagrant-logs/$target.checkbox-provider.err)"
146
cat $TIMING | sed -e "s/^/[$target] (timing) /"
57
# Run test suite commands here.
58
# Tests are found in each component's requirements/ dir and are named *container-tests-*
59
# Numbers can be used at the beginning to control running order within each component.
60
# Tests scripts are expected to:
61
# - Be run from the *component's* top-level directory. This is a convenience to avoid
62
# a boilerplate "cd .." on every test script. So for 'plainbox' we do the equivalent of
65
# - Exit 0 for success, other codes for failure
66
# - Write logs/debugging data to stdout and stderr.
67
for test_script in $(find ./ -path '*/requirements/*container-tests-*' | sort); do
68
echo "Found a test script: $test_script"
69
test_name=$(basename $test_script)
70
# Two dirnames strips the requirements/ component
71
component_dir=$(dirname $(dirname $test_script))
72
# Inside the VM, tests are relative to $HOME/src.
73
# Note that for vagrant, we want $HOME to expand *inside* the VM, so
74
# that part of the command is in *single* quotes, otherwise we get the
75
# $HOME from the host. However, $component_dir and $test_name should
76
# come from the host, so we use double quotes.
77
script_md5sum=$(echo $test_script | md5sum |cut -d " " -f 1)
78
logfile=vagrant-logs/${target}.${test_name}.${script_md5sum}.log
79
errfile=vagrant-logs/${target}.${test_name}.${script_md5sum}.err
80
if /usr/bin/time -o $TIMING vagrant ssh $target -c 'cd $HOME/src/'"$component_dir && ./requirements/$test_name" >$logfile 2>$errfile
82
echo "[$target] ${test_name}: $PASS"
85
echo "[$target] ${test_name}: $FAIL"
86
echo "[$target] stdout: $(pastebinit $logfile)"
87
echo "[$target] stderr: $(pastebinit $errfile)"
89
cat $TIMING | sed -e "s/^/[$target] (timing) /"
148
92
# Decide what to do with the VM
149
93
case $VAGRANT_DONE_ACTION in