kicad/old/scripts/KiBoM/tests/common.bash

35 lines
456 B
Bash
Raw Normal View History

2020-02-04 17:33:02 -07:00
#!/usr/bin/env bash
# Common functions for running various tests
PASSED=0
FAILED=0
# Results
result() {
echo "--- Results ---"
echo "${PASSED}/$((PASSED+FAILED))"
if (( FAILED == 0 )); then
return 0
else
return 1
fi
}
# Runs a command, increments test passed/failed
# Args: Command
cmd() {
# Run command
echo "CMD: $@"
$@
local RET=$?
# Check command
if [[ ${RET} -ne 0 ]]; then
((FAILED++))
else
((PASSED++))
fi
return ${RET}
}