File: run_donate_cpu_client_tests.sh

package info (click to toggle)
cppcheck 2.18.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 26,132 kB
  • sloc: cpp: 268,935; python: 20,890; ansic: 8,090; sh: 1,045; makefile: 1,008; xml: 1,005; cs: 291
file content (49 lines) | stat: -rwxr-xr-x 1,782 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
#
# Script for verifying that the donate-cpu.py script works under different circumstances (Python
# version, parameters, ...).
# Good for checking if everything still works before committing changes to donate-cpu.py.

# Detect and report errors
errors_occurred=0

error_occurred() {
  echo "#######################################################################"
  echo "ERROR: On line $(caller), errorcode: $?" >&2
  echo "#######################################################################"
  errors_occurred=1
}

trap error_occurred ERR

# Run tests
client_script=../donate-cpu.py
test_packages=(
ftp://ftp.se.debian.org/debian/pool/main/0/0xffff/0xffff_0.8.orig.tar.gz
ftp://ftp.se.debian.org/debian/pool/main/a/actionaz/actionaz_3.8.0.orig.tar.gz
)

for python_exec in "python3"
do
    for test_package in "${test_packages[@]}"
    do
        echo "Testing package ${test_package} with ${python_exec} ..."
        ${python_exec} ${client_script} --package=${test_package}
        ${python_exec} ${client_script} --package=${test_package} -j1
        ${python_exec} ${client_script} --package=${test_package} -j2
        ${python_exec} ${client_script} --package=${test_package} --bandwidth-limit=250k
        ${python_exec} ${client_script} --package=${test_package} -j2 --bandwidth-limit=0.5M
        ${python_exec} ${client_script} --package=${test_package} --max-packages=1
    done
done

# Report result and exit accordingly
if [ $errors_occurred -eq 0 ]; then
  echo "All tests successfully finished."
  exit 0
else
  echo "#######################################################################"
  echo "ERRORS OCCURRED! See error messages above for details."
  echo "#######################################################################"
  exit 1
fi