forked from microsoft/winget-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·60 lines (47 loc) · 1.2 KB
/
Copy pathtest.sh
File metadata and controls
executable file
·60 lines (47 loc) · 1.2 KB
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
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# Synopsis: Simplifies test commands for the SFS Client.
#
# Description: This script will contain the test commands for the SFS Client.
# Use this on non-Windows platforms in a bash session.
#
# Example:
# $ ./scripts/test.sh
#
# Ensures script stops on errors
set -e
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
error "Script is being sourced, it should be executed instead."
return 1
fi
output_on_failure=false
usage() { echo "Usage: $0 [--output-on-failure]" 1>&2; exit 1; }
if ! opts=$(getopt \
--longoptions "output-on-failure" \
--name "$(basename "$0")" \
--options "" \
-- "$@"
); then
usage
fi
eval set "--$opts"
while [ $# -gt 0 ]; do
case "$1" in
--output-on-failure)
output_on_failure=true
shift 1
;;
*)
break
;;
esac
done
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)"
git_root=$(git -C "$script_dir" rev-parse --show-toplevel)
build_folder="$git_root/build"
cmd="ctest --test-dir \"$build_folder/client\""
if $output_on_failure ; then
cmd+=" --output-on-failure"
fi
eval "$cmd"