diff options
Diffstat (limited to '.travis/test')
-rwxr-xr-x | .travis/test/mutual_friends.sh | 10 | ||||
-rwxr-xr-x | .travis/test/online_sessions.sh | 31 | ||||
-rwxr-xr-x | .travis/test/show_status.sh | 7 | ||||
-rwxr-xr-x | .travis/test/track_status.sh | 23 |
4 files changed, 33 insertions, 38 deletions
diff --git a/.travis/test/mutual_friends.sh b/.travis/test/mutual_friends.sh index ebe0c17..ebecf8e 100755 --- a/.travis/test/mutual_friends.sh +++ b/.travis/test/mutual_friends.sh @@ -7,15 +7,13 @@ set -o errexit -o nounset -o pipefail -mutual_friends() { - echo 'Running mutual_friends.py --format csv...' - python3 -m bin.mutual_friends --format csv "$@" - echo 'Running mutual_friends.py --format json...' - python3 -m bin.mutual_friends --format json "$@" +test_users() { + ./.travis/test.sh bin.mutual_friends --format csv "$@" + ./.travis/test.sh bin.mutual_friends --format json "$@" } main() { - mutual_friends kreed58 maxkorzh_official + test_users kreed58 maxkorzh_official } main "$@" diff --git a/.travis/test/online_sessions.sh b/.travis/test/online_sessions.sh index b8a56de..7d26630 100755 --- a/.travis/test/online_sessions.sh +++ b/.travis/test/online_sessions.sh @@ -9,14 +9,7 @@ set -o errexit -o nounset -o pipefail readonly db_path='.travis/test_db.csv' -fix_matplotlib() { - # Get rid of: - # tkinter.TclError: no display name and no $DISPLAY environment variable - mkdir -p -- ~/.config/matplotlib - echo 'backend: Agg' > ~/.config/matplotlib/matplotlibrc -} - -_online_sessions() { +try_output() { local output_path output_path="$( mktemp --dry-run )" @@ -25,8 +18,7 @@ _online_sessions() { trap "$rm_aux_files" RETURN - echo "Running online_sessions.py..." - python3 -m bin.online_sessions "$@" "$db_path" "$output_path" + ./.travis/test.sh bin.online_sessions "$@" "$db_path" "$output_path" if file --brief --dereference --mime -- "$output_path" | grep --quiet -- 'charset=binary$'; then echo 'Output is a binary file, not going to show that' @@ -38,13 +30,20 @@ _online_sessions() { } online_sessions() { - _online_sessions --group-by user --output-format csv - _online_sessions --group-by user --output-format json + try_output --group-by user --output-format csv + try_output --group-by user --output-format json - _online_sessions --group-by user --output-format plot - _online_sessions --group-by hour --output-format plot - _online_sessions --group-by date --output-format plot - _online_sessions --group-by weekday --output-format plot + try_output --group-by user --output-format plot + try_output --group-by hour --output-format plot + try_output --group-by date --output-format plot + try_output --group-by weekday --output-format plot +} + +fix_matplotlib() { + # Get rid of: + # tkinter.TclError: no display name and no $DISPLAY environment variable + mkdir -p -- ~/.config/matplotlib + echo 'backend: Agg' > ~/.config/matplotlib/matplotlibrc } main() { diff --git a/.travis/test/show_status.sh b/.travis/test/show_status.sh index afba9aa..ff0ce47 100755 --- a/.travis/test/show_status.sh +++ b/.travis/test/show_status.sh @@ -7,13 +7,12 @@ set -o errexit -o nounset -o pipefail -show_status() { - echo 'Running show_status.py...' - python3 -m bin.show_status "$@" +test_users() { + ./.travis/test.sh bin.show_status "$@" } main() { - show_status egor.tensin + test_users egor.tensin } main "$@" diff --git a/.travis/test/track_status.sh b/.travis/test/track_status.sh index afdfea1..2b3e001 100755 --- a/.travis/test/track_status.sh +++ b/.travis/test/track_status.sh @@ -7,33 +7,32 @@ set -o errexit -o nounset -o pipefail -track_status() { +test_users() { local log_path log_path="$( mktemp )" - echo "Log file path: $log_path" - local db_path db_path="$( mktemp --dry-run )" - echo "DB file path: $db_path" local rm_aux_files rm_aux_files="$( printf -- 'rm -f -- %q %q' "$log_path" "$db_path" )" - trap "$rm_aux_files" RETURN - echo 'Running track_status.py...' - python3 -m bin.track_status "$@" --log "$log_path" --format csv --output "$db_path" & + ./.travis/test.sh bin.track_status "$@" --log "$log_path" --format csv --output "$db_path" & local pid="$!" - echo "Its PID is $pid" - local timeout=15 + sleep 3 + echo "Log file path: $log_path" + echo "DB file path: $db_path" + echo "PID: $pid" + + local timeout=10 echo "Sleeping for $timeout seconds..." sleep "$timeout" echo 'Terminating track_status.py...' - kill -SIGINT "$pid" + kill "$pid" echo 'Waiting for track_status.py to terminate...' - wait "$pid" + wait "$pid" || true echo "Log file:" cat "$log_path" @@ -42,7 +41,7 @@ track_status() { } main() { - track_status egor.tensin + test_users egor.tensin } main "$@" |