Tapper-autoreport is a project mainly written in Shell, based on the BSD-2-Clause license.
Tapper - turn your bash scripts into Tapper test scripts
This is the tapper-autoreport
bash utility -- a bash include file
that you include ("source") at the end of your own bash script.
It then magically turns your bash script into a Tapper test suite.
It collects meta information from system, reports test results via network and uploads files.
It also allows your bash script to be used with the prove
command,
a tool to run test scripts that produce TAP output (Test Anything
Protocol).
#! /bin/bash
# your own stuff here ...
. /tapper-autoreport
explanation:
#! /bin/bash
append_tap "ok - affe loewe tiger"
append_tap "ok - some other description"
append_tap "not ok - yet another test description"
append_tapdata "timecpb: 12.345"
append_tapdata "timenocpb: 23.456"
SUITENAME="CPUID-ON"
SUITEVERSION="2.007"
OSNAME="Gentoo 10.1"
CHANGESET="98765"
HOSTNAME="J-F-Sebastian"
TICKETURL='https://osrc.amd.com/bugs/show_bug.cgi?id=901'
WIKIURL=https://osrc.amd.com/wiki/Pharaoh_hound_c-state_boost_evaluation
PLANNINGID=osrc.hv.xen.multicore
TAPPER_REPORT_SERVER="tapper-devel"
NOSEND=1
uname -a | grep -q Linux # example for exit code
. /tapper-autoreport nok /tmp/results.log $?
explanation:
$ prove ./trivial-example-1.sh
./trivial-example-1.sh .. ok
All tests successful.
Files=1, Tests=5, 20 wallclock secs
Result: PASS
explanation:
$ ./trivial-example-1.sh
# http://perlformance.net/tapper/reports/id/1
# - upload ./trivial-example-1.sh ...
# - upload /boot/config-2.6.32-22-generic ...
# - upload /proc/cpuinfo ...
# - upload /proc/devices ...
# - upload /proc/version ...
explanation:
TAP[*]
- Array of TAP linesTAPDATA[*]
- Array of YAML lines that contain data in TAPHEADERS[*]
- Array of Tapper headersOUTPUT[*]
- Array of additional output linesSUITENAME
- alternative suite name instead of $0SUITEVERSION
- alternative suite versionKEYWORDS
- space separated keywords to influence suite nameOSNAME
- alternative OS descriptionCHANGESET
- alternative changesetHOSTNAME
- alternative hostnameTAPPER_REPORT_SERVER
- alternative report serverTICKETURL
- relevant URL in used ticket system (Bugzilla)WIKIURL
- relevant URL in used wikiPLANNINGID
- relevant task planning id (MS Project, TaskJuggler)NOSEND
- if "1" no sending to Tapper happensNOUPLOAD
- if "1" no uploading of default files happensImport utility functions at the beginning of the script via
. ./tapper-autoreport --import-utils
Then you have the following functions available
require_cpufeature "cpb"
Checks that the string "cpb" in /proc/cpuinfo and exits in a TAP conform way otherwise.
require_program "bc"
Checks that the program "bc" is available and exits in a TAP conform way otherwise.
require_root
Checks that the user executing the script is root (UID 0).
ok ARG1 "some description"
Evaluates the first argument with Shell boolean semantics (0 is true) and appends a corresponding TAP line.
negate_ok ARG1 "some description"
Evaluates the first argument with Shell inverse boolean semantics (0 is false) and appends a corresponding TAP line.
append_tap "ok - some description"
Appends a complete TAP line where you have taken care for the
"ok
"/"not ok
" at the beginning.
append_tapdata "key: value"
Appends a key:value line at the tapdata YAML block. The key must start with letter and consist of only alphanum an underscore.
main_after_hook()
They look like this: http://tapper/tapper/reports/id/129218