~saviq/+junk/jenkaas-scripts

« back to all changes in this revision

Viewing changes to test/0-autopkgtest-1-run.sh

  • Committer: Michał Sawicz
  • Date: 2016-02-02 10:48:04 UTC
  • Revision ID: michal.sawicz@canonical.com-20160202104804-h25lmiv13lrj1z7d
Add autopkgtest scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
# log all commands and abort on error
 
4
set -xe
 
5
 
 
6
OUTDIR=${PWD}/output
 
7
 
 
8
# unzip artifacts downloaded in the previous step
 
9
unzip source.zip
 
10
unzip binary.zip
 
11
 
 
12
# run autopkgtests using the unpacked source and binary packages
 
13
env DEB_BUILD_OPTIONS="parallel="`nproc` \
 
14
  adt-run archive/output/*.deb \
 
15
    --no-built-binaries \
 
16
    --source archive/output/*.dsc \
 
17
    --output-dir output \
 
18
    --summary output/summary \
 
19
    --log-file log \
 
20
    --apt-upgrade \
 
21
    --- schroot ${release}-${label##*-} \
 
22
  || ADT_EXIT=$?
 
23
 
 
24
mkdir -p output/artifacts
 
25
 
 
26
# if passed or no tests (see EXIT STATUS in man adt-run)
 
27
if [ -z "${ADT_EXIT}" ] || [ $ADT_EXIT -eq 8 ]; then
 
28
  ADT_EXIT=0
 
29
  cat > output/artifacts/adt-run.xml <<EOF
 
30
<?xml version="1.0" encoding="UTF-8" ?>
 
31
<testsuite errors="0" failures="0" tests="1" name="adt-run">
 
32
  <testcase result="${RESULT}" name="adt-run"/>
 
33
</testsuite>
 
34
EOF
 
35
else
 
36
# everything else is unexpected
 
37
  cat > output/artifacts/adt-run.xml <<EOF
 
38
<?xml version="1.0" encoding="UTF-8" ?>
 
39
<testsuite errors="0" failures="${FAILURES}" tests="1" name="adt-run">
 
40
  <testcase result="${RESULT}" name="adt-run">
 
41
    <failure message="adt-run exit code: ${ADT_EXIT}" result="${RESULT}"/>
 
42
  </testcase>
 
43
</testsuite>
 
44
EOF
 
45
fi
 
46
 
 
47
# if skipped and/or failed, exit 0 to go UNSTABLE instead of FAILED
 
48
[ ${ADT_EXIT} -eq 2 -o ${ADT_EXIT} -eq 4 -o $ADT_EXIT -eq 6 ] && exit 0
 
49
 
 
50
exit ${ADT_EXIT}