aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.travis/test
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-03-11 17:13:17 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-03-11 17:13:17 +0300
commit68d795158f31f349599dfb59e435ca4daf7370bc (patch)
tree7deacbc36476656dbcad8ab766bdcf2ad8f37d0c /.travis/test
parentTravis: prettier output (diff)
downloadvk-scripts-68d795158f31f349599dfb59e435ca4daf7370bc.tar.gz
vk-scripts-68d795158f31f349599dfb59e435ca4daf7370bc.zip
Travis: restructure .travis/
Diffstat (limited to '')
-rwxr-xr-x.travis/bin/mutual_friends.sh (renamed from .travis/test/mutual_friends.sh)10
-rwxr-xr-x.travis/bin/online_sessions.sh (renamed from .travis/test/online_sessions.sh)10
-rwxr-xr-x.travis/bin/show_status.sh (renamed from .travis/test/show_status.sh)8
-rwxr-xr-x.travis/bin/track_status.sh (renamed from .travis/test/track_status.sh)6
-rwxr-xr-x.travis/lib/test.sh (renamed from .travis/test.sh)6
-rw-r--r--.travis/share/test_db.csv (renamed from .travis/test_db.csv)0
6 files changed, 30 insertions, 10 deletions
diff --git a/.travis/test/mutual_friends.sh b/.travis/bin/mutual_friends.sh
index ebecf8e..4a00fb8 100755
--- a/.travis/test/mutual_friends.sh
+++ b/.travis/bin/mutual_friends.sh
@@ -7,13 +7,17 @@
set -o errexit -o nounset -o pipefail
+script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
+script_dir="$( cd -- "$script_dir" && pwd )"
+readonly script_dir
+
test_users() {
- ./.travis/test.sh bin.mutual_friends --format csv "$@"
- ./.travis/test.sh bin.mutual_friends --format json "$@"
+ "$script_dir/../lib/test.sh" bin.mutual_friends --format csv "$@"
+ "$script_dir/../lib/test.sh" bin.mutual_friends --format json "$@"
}
main() {
test_users kreed58 maxkorzh_official
}
-main "$@"
+main
diff --git a/.travis/test/online_sessions.sh b/.travis/bin/online_sessions.sh
index 7d26630..2534735 100755
--- a/.travis/test/online_sessions.sh
+++ b/.travis/bin/online_sessions.sh
@@ -7,7 +7,11 @@
set -o errexit -o nounset -o pipefail
-readonly db_path='.travis/test_db.csv'
+script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
+script_dir="$( cd -- "$script_dir" && pwd )"
+readonly script_dir
+
+readonly db_path="$script_dir/../share/test_db.csv"
try_output() {
local output_path
@@ -18,7 +22,7 @@ try_output() {
trap "$rm_aux_files" RETURN
- ./.travis/test.sh bin.online_sessions "$@" "$db_path" "$output_path"
+ "$script_dir/../lib/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'
@@ -51,4 +55,4 @@ main() {
online_sessions
}
-main "$@"
+main
diff --git a/.travis/test/show_status.sh b/.travis/bin/show_status.sh
index ff0ce47..c9f8e26 100755
--- a/.travis/test/show_status.sh
+++ b/.travis/bin/show_status.sh
@@ -7,12 +7,16 @@
set -o errexit -o nounset -o pipefail
+script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
+script_dir="$( cd -- "$script_dir" && pwd )"
+readonly script_dir
+
test_users() {
- ./.travis/test.sh bin.show_status "$@"
+ "$script_dir/../lib/test.sh" bin.show_status "$@"
}
main() {
test_users egor.tensin
}
-main "$@"
+main
diff --git a/.travis/test/track_status.sh b/.travis/bin/track_status.sh
index 2b3e001..9aedb6b 100755
--- a/.travis/test/track_status.sh
+++ b/.travis/bin/track_status.sh
@@ -7,6 +7,10 @@
set -o errexit -o nounset -o pipefail
+script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
+script_dir="$( cd -- "$script_dir" && pwd )"
+readonly script_dir
+
test_users() {
local log_path
log_path="$( mktemp )"
@@ -17,7 +21,7 @@ test_users() {
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" &
+ "$script_dir/../lib/test.sh" bin.track_status "$@" --log "$log_path" --format csv --output "$db_path" &
local pid="$!"
sleep 3
diff --git a/.travis/test.sh b/.travis/lib/test.sh
index 83c4efa..c91ce48 100755
--- a/.travis/test.sh
+++ b/.travis/lib/test.sh
@@ -7,6 +7,10 @@
set -o errexit -o nounset -o pipefail
+script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
+script_dir="$( cd -- "$script_dir" && pwd )"
+readonly script_dir
+
run_test() {
local arg
echo
@@ -17,7 +21,7 @@ run_test() {
echo
echo ======================================================================
- python3 -m "$@"
+ PYTHONPATH="$script_dir/../.." python3 -m "$@"
}
run_test "$@"
diff --git a/.travis/test_db.csv b/.travis/share/test_db.csv
index 2b087a8..2b087a8 100644
--- a/.travis/test_db.csv
+++ b/.travis/share/test_db.csv