From 68d795158f31f349599dfb59e435ca4daf7370bc Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 11 Mar 2020 17:13:17 +0300 Subject: Travis: restructure .travis/ --- .travis/test/mutual_friends.sh | 19 --------------- .travis/test/online_sessions.sh | 54 ----------------------------------------- .travis/test/show_status.sh | 18 -------------- .travis/test/track_status.sh | 47 ----------------------------------- 4 files changed, 138 deletions(-) delete mode 100755 .travis/test/mutual_friends.sh delete mode 100755 .travis/test/online_sessions.sh delete mode 100755 .travis/test/show_status.sh delete mode 100755 .travis/test/track_status.sh (limited to '.travis/test') diff --git a/.travis/test/mutual_friends.sh b/.travis/test/mutual_friends.sh deleted file mode 100755 index ebecf8e..0000000 --- a/.travis/test/mutual_friends.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2019 Egor Tensin -# This file is part of the "VK scripts" project. -# For details, see https://github.com/egor-tensin/vk-scripts. -# Distributed under the MIT License. - -set -o errexit -o nounset -o pipefail - -test_users() { - ./.travis/test.sh bin.mutual_friends --format csv "$@" - ./.travis/test.sh bin.mutual_friends --format json "$@" -} - -main() { - test_users kreed58 maxkorzh_official -} - -main "$@" diff --git a/.travis/test/online_sessions.sh b/.travis/test/online_sessions.sh deleted file mode 100755 index 7d26630..0000000 --- a/.travis/test/online_sessions.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2019 Egor Tensin -# This file is part of the "VK scripts" project. -# For details, see https://github.com/egor-tensin/vk-scripts. -# Distributed under the MIT License. - -set -o errexit -o nounset -o pipefail - -readonly db_path='.travis/test_db.csv' - -try_output() { - local output_path - output_path="$( mktemp --dry-run )" - - local rm_aux_files - rm_aux_files="$( printf -- 'rm -f -- %q' "$output_path" )" - - trap "$rm_aux_files" RETURN - - ./.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' - return 0 - fi - - echo "Output:" - cat "$output_path" -} - -online_sessions() { - try_output --group-by user --output-format csv - try_output --group-by user --output-format json - - 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() { - fix_matplotlib - online_sessions -} - -main "$@" diff --git a/.travis/test/show_status.sh b/.travis/test/show_status.sh deleted file mode 100755 index ff0ce47..0000000 --- a/.travis/test/show_status.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2019 Egor Tensin -# This file is part of the "VK scripts" project. -# For details, see https://github.com/egor-tensin/vk-scripts. -# Distributed under the MIT License. - -set -o errexit -o nounset -o pipefail - -test_users() { - ./.travis/test.sh bin.show_status "$@" -} - -main() { - test_users egor.tensin -} - -main "$@" diff --git a/.travis/test/track_status.sh b/.travis/test/track_status.sh deleted file mode 100755 index 2b3e001..0000000 --- a/.travis/test/track_status.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2019 Egor Tensin -# This file is part of the "VK scripts" project. -# For details, see https://github.com/egor-tensin/vk-scripts. -# Distributed under the MIT License. - -set -o errexit -o nounset -o pipefail - -test_users() { - local log_path - log_path="$( mktemp )" - local db_path - db_path="$( mktemp --dry-run )" - - local rm_aux_files - rm_aux_files="$( printf -- 'rm -f -- %q %q' "$log_path" "$db_path" )" - trap "$rm_aux_files" RETURN - - ./.travis/test.sh bin.track_status "$@" --log "$log_path" --format csv --output "$db_path" & - local pid="$!" - - 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 "$pid" - echo 'Waiting for track_status.py to terminate...' - wait "$pid" || true - - echo "Log file:" - cat "$log_path" - echo "DB:" - cat "$db_path" -} - -main() { - test_users egor.tensin -} - -main "$@" -- cgit v1.2.3