forked from Mirror/pmbootstrap
Travis CI: folded output/default tracebacks (#1331)
* Moved the `script` and `after_failure` sections of `.travis.yml` to extra files in a new `.travis/` folder * Copy paste `.travis/common.sh` from Alpine's aport. They have neat formatting functions in there for folding * Add a folding block around each script that gets called * Use native tracebacks in pytest. These are the same as we see when pmbootstrap crashes usually, instead of printing out the entire function that causes an error. I think this makes the error output easier to read.
This commit is contained in:
parent
49e15b322c
commit
f75ac13a4f
5 changed files with 99 additions and 8 deletions
|
@ -9,15 +9,10 @@ install:
|
||||||
- sudo apt install shellcheck qemu-system-x86
|
- sudo apt install shellcheck qemu-system-x86
|
||||||
- pip install flake8 pytest-cov python-coveralls
|
- pip install flake8 pytest-cov python-coveralls
|
||||||
script:
|
script:
|
||||||
- test/static_code_analysis.sh
|
- .travis/travis_script.sh
|
||||||
- yes "" | ./pmbootstrap.py init
|
|
||||||
- ./pmbootstrap.py kconfig_check
|
|
||||||
- test/check_checksums.py --build
|
|
||||||
- test/testcases_fast.sh --all
|
|
||||||
after_success:
|
after_success:
|
||||||
- coveralls
|
- coveralls
|
||||||
after_failure:
|
after_failure:
|
||||||
- cat ~/.local/var/pmbootstrap/log.txt
|
- .travis/travis_after_failure.sh
|
||||||
- cat ~/.local/var/pmbootstrap/log_testsuite.txt
|
|
||||||
notifications:
|
notifications:
|
||||||
- email: false
|
- email: false
|
||||||
|
|
45
.travis/common.sh
Normal file
45
.travis/common.sh
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# Source: .travis/common.sh from Alpine's aports repo
|
||||||
|
|
||||||
|
die() {
|
||||||
|
print -s1 -c1 "$@\n" 1>&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Marks start of named folding section for Travis and prints title.
|
||||||
|
fold_start() {
|
||||||
|
local name="$1"
|
||||||
|
local title="$2"
|
||||||
|
|
||||||
|
printf "\ntravis_fold:start:$name "
|
||||||
|
print -s1 -c6 "> $title\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Marks end of the named folding section.
|
||||||
|
fold_end() {
|
||||||
|
local name="$1"
|
||||||
|
|
||||||
|
printf "travis_fold:end:$name\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prints formatted and colored text.
|
||||||
|
print() {
|
||||||
|
local style=0
|
||||||
|
local fcolor=9
|
||||||
|
|
||||||
|
local opt; while getopts 's:c:' opt; do
|
||||||
|
case "$opt" in
|
||||||
|
s) style="$OPTARG";;
|
||||||
|
c) fcolor="$OPTARG";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
shift $(( OPTIND - 1 ))
|
||||||
|
local text="$@"
|
||||||
|
|
||||||
|
printf "\033[${style};3${fcolor}m$text\033[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
title() {
|
||||||
|
printf '\n'
|
||||||
|
print -s1 -c6 "==> $@\n"
|
||||||
|
}
|
18
.travis/travis_after_failure.sh
Executable file
18
.travis/travis_after_failure.sh
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
# Go to pmbootstrap folder
|
||||||
|
DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
||||||
|
cd "$DIR/.."
|
||||||
|
|
||||||
|
# Functions for pretty Travis output
|
||||||
|
. .travis/common.sh
|
||||||
|
|
||||||
|
# pmbootstrap log
|
||||||
|
fold_start "log.1" "pmbootstrap log"
|
||||||
|
cat ~/.local/var/pmbootstrap/log.txt
|
||||||
|
fold_end "log.1"
|
||||||
|
|
||||||
|
# Testsuite log
|
||||||
|
fold_start "log.2" "Testsuite log"
|
||||||
|
cat ~/.local/var/pmbootstrap/log_testsuite.txt
|
||||||
|
fold_end "log.2"
|
33
.travis/travis_script.sh
Executable file
33
.travis/travis_script.sh
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
# Go to pmbootstrap folder
|
||||||
|
DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
||||||
|
cd "$DIR/.."
|
||||||
|
|
||||||
|
# Functions for pretty Travis output
|
||||||
|
. .travis/common.sh
|
||||||
|
|
||||||
|
# Static code analysis
|
||||||
|
fold_start "static_analysis" "Static code analysis"
|
||||||
|
test/static_code_analysis.sh
|
||||||
|
fold_end "static_analysis"
|
||||||
|
|
||||||
|
# pmbootstrap init
|
||||||
|
fold_start "init" "pmbootstrap init"
|
||||||
|
yes "" | ./pmbootstrap.py init
|
||||||
|
fold_end "init"
|
||||||
|
|
||||||
|
# pmbootstrap kconfig_check
|
||||||
|
fold_start "kconfig_check" "pmbootstrap kconfig_check"
|
||||||
|
./pmbootstrap.py kconfig_check
|
||||||
|
fold_end "kconfig_check"
|
||||||
|
|
||||||
|
# pmbootstrap build --strict
|
||||||
|
fold_start "build" "pmbootstrap build --strict"
|
||||||
|
test/check_checksums.py --build
|
||||||
|
fold_end "build"
|
||||||
|
|
||||||
|
# Testsuite
|
||||||
|
fold_start "testsuite" "Testsuite and code coverage"
|
||||||
|
test/testcases_fast.sh --all
|
||||||
|
fold_end "testsuite"
|
|
@ -35,4 +35,4 @@ done
|
||||||
|
|
||||||
# Run enabled testcases with coverage enabled
|
# Run enabled testcases with coverage enabled
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
pytest --cov=pmb $enabled
|
pytest --cov=pmb $enabled --tb=native
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue