Files
swupd-client/scripts/github_actions/weight_tests.bash
Otavio Pontes 2fe40faf10 test: Group tests that can be run only on in CI
2 groups were created:
 - slow: Tests that are very slow because of sleeps, so we can run them all
   in parallel
 - system: Tests that make change to the system, so they can cause problems
   when running in parallel, so we run them in series.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-01 08:38:15 -07:00

21 lines
440 B
Bash
Executable File

#!/bin/bash
MAX_WEIGHT=40
if [ -z "$1" ]; then
TESTS=$(find test/functional/ -name "*.bats" \( ! -path "*only_in_ci*" \))
else
TESTS="$*"
fi
for t in $TESTS; do
echo "Running $t"
WEIGHT=$(($(/usr/bin/time -f %e "$t" 2>&1 |tail -n 1 |cut -d '.' -f 1)+1))
echo "$WEIGHT"
if [ $WEIGHT -gt "$MAX_WEIGHT" ]; then
WEIGHT="$MAX_WEIGHT"
fi
sed -i "/#WEIGHT/d" "$t"
echo "#WEIGHT=$WEIGHT" >> "$t"
done