forked from Yubico/yubioath-flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testrunner.sh
executable file
·96 lines (80 loc) · 2.68 KB
/
testrunner.sh
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
#
# Copyright (C) 2022 Yubico.
#
# This file defines which tests we should run in the CI environment
# It is now being used to check for flakiness, as we haven't decided
# which tests will be run in CI.
case "$(uname)" in
Darwin*)
OS="macos";;
Linux*)
OS="linux";;
MINGW*)
OS="windows";;
esac
# directory containing the integration tests
int_directory="integration_test/"
# Measure the start time
start_time=$(date +%s.%N)
# Run the keyless tests and measure the time
keyless_start_time=$(date +%s.%N)
outputKeyless=$(flutter test -d $OS "$int_directory"keyless_test.dart)
keyless_end_time=$(date +%s.%N)
keyless_time=$(echo "$keyless_end_time - $keyless_start_time" | bc)
# Run the management tests and measure the time
management_start_time=$(date +%s.%N)
outputManagement=$(flutter test -d $OS "$int_directory"management_test.dart)
management_end_time=$(date +%s.%N)
management_time=$(echo "$management_end_time - $management_start_time" | bc)
# Run the PIV tests and measure the time
piv_start_time=$(date +%s.%N)
outputPiv=$(flutter test -d $OS "$int_directory"piv_test.dart)
piv_end_time=$(date +%s.%N)
piv_time=$(echo "$piv_end_time - $piv_start_time" | bc)
# Run the OATH tests and measure the time
oath_start_time=$(date +%s.%N)
outputOath=$(flutter test -d $OS "$int_directory"oath_test.dart)
oath_end_time=$(date +%s.%N)
oath_time=$(echo "$oath_end_time - $oath_start_time" | bc)
# Run the webauthn tests and measure the time
webauthn_start_time=$(date +%s.%N)
outputWebauthn=$(flutter test -d $OS "$int_directory"webauthn_test.dart)
webauthn_end_time=$(date +%s.%N)
webauthn_time=$(echo "$webauthn_end_time - $webauthn_start_time" | bc)
# Measure the end time
end_time=$(date +%s.%N)
# Calculate the total time
total_time=$(echo "$end_time - $start_time" | bc)
# Output the measured times
if [[ $outputPiv == *"All tests passed"* ]]; then
echo "All PIV tests passed: $piv_time seconds"
else
echo "PIV tests failed"
echo $outputPiv
fi
if [[ $outputOath == *"All tests passed"* ]]; then
echo "All OATH tests passed: $oath_time seconds"
else
echo "OATH tests failed"
echo $outputOath
fi
if [[ $outputWebauthn == *"All tests passed"* ]]; then
echo "All Webauthn tests passed: $webauthn_time seconds"
else
echo "Webauthn tests failed"
echo $outputWebauthn
fi
if [[ $outputKeyless == *"All tests passed"* ]]; then
echo "All Keyless tests passed: $keyless_time seconds"
else
echo "Keyless tests failed"
echo $outputKeyless
fi
if [[ $outputManagement == *"All tests passed"* ]]; then
echo "All Management tests passed: $management_time seconds"
else
echo "Managemet tests failed"
echo $outputManagement
fi
echo "Total time: $total_time seconds"