-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_impl.sh
More file actions
executable file
·122 lines (115 loc) · 3.28 KB
/
Copy pathtest_impl.sh
File metadata and controls
executable file
·122 lines (115 loc) · 3.28 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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$ROOT"
export XDG_CONFIG_HOME="/tmp/ccc-test-xdg-config"
export XDG_CACHE_HOME="/tmp/ccc-test-xdg-cache"
export XDG_DATA_HOME="/tmp/ccc-test-xdg-data"
export XDG_STATE_HOME="/tmp/ccc-test-xdg-state"
export CCC_CONFIG="/tmp/ccc-test-missing-config.toml"
export GOCACHE="/tmp/ccc-go-cache"
export ZIG_GLOBAL_CACHE_DIR="/tmp/ccc-zig-global-cache"
export ZIG_LOCAL_CACHE_DIR="/tmp/ccc-zig-local-cache"
export DOTNET_CLI_HOME="/tmp/ccc-dotnet-home"
export CRYSTAL_CACHE_DIR="/tmp/ccc-crystal-cache"
export CABAL_DIR="/tmp/ccc-cabal"
export LC_ALL=C
export PERL_BADLANG=0
export DOTNET_NOLOGO=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1
mkdir -p \
"$XDG_CONFIG_HOME" \
"$XDG_CACHE_HOME" \
"$XDG_DATA_HOME" \
"$XDG_STATE_HOME" \
"$GOCACHE" \
"$ZIG_GLOBAL_CACHE_DIR" \
"$ZIG_LOCAL_CACHE_DIR" \
"$DOTNET_CLI_HOME" \
"$CRYSTAL_CACHE_DIR" \
"$CABAL_DIR"
mkdir -p "$XDG_CONFIG_HOME/ccc"
: > "$XDG_CONFIG_HOME/ccc/config.toml"
if [ "$#" -ne 1 ]; then
echo "usage: ./test_impl.sh <language|all>" >&2
exit 2
fi
LANGUAGE="$1"
run_unit_tests() {
case "$LANGUAGE" in
all)
return 0
;;
python)
PYTHONPATH=python python3 -m unittest tests.test_runner tests.test_json_output tests.test_parser_config -v
;;
rust)
(cd rust && cargo test)
;;
typescript|ts)
node --test typescript/tests/*.mjs
;;
c)
CC=/usr/bin/gcc make -C c test
;;
go)
(cd go && go test ./... && go vet ./...)
;;
ruby)
(cd ruby && ruby -Ilib -Itest test/test_*.rb)
;;
perl)
(cd perl && prove -v t/)
;;
cpp|c++)
cmake -B cpp/build -S cpp
cmake --build cpp/build --target ccc_tests
./cpp/build/tests/ccc_tests
;;
zig)
(cd zig && zig build test)
;;
crystal)
(cd crystal && PATH=/usr/bin:$PATH crystal spec)
;;
d)
(cd d && PATH=/usr/bin:$PATH dub test)
;;
fsharp|f#)
(cd fsharp && dotnet test)
;;
php)
(cd php && for t in tests/*Test.php; do php "$t"; done)
;;
purescript)
(cd purescript && spago test)
;;
asm|x86-64-asm)
(cd asm-x86_64 && bash tests/test_ccc.sh)
;;
ocaml)
(cd ocaml && eval "$(opam env)" && dune runtest)
;;
elixir)
(cd elixir && mix test)
;;
nim)
(cd nim && for t in tests/test_*.nim; do PATH=/usr/bin:/home/xertrov/.nimble/bin:$PATH nim c -r --path:src --path:. "$t"; done)
;;
haskell)
(cd haskell && cabal test call-coding-clis-test)
;;
*)
echo "unknown language '$LANGUAGE'" >&2
exit 2
;;
esac
}
if [ "$LANGUAGE" = "all" ]; then
./run_all_tests.sh
exit 0
fi
run_unit_tests
PYTHONPATH=python python3 tests/test_ccc_contract_impl.py "$LANGUAGE" -v
PYTHONPATH=python python3 tests/test_harness.py "$LANGUAGE" -v