-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.sh
executable file
·127 lines (117 loc) · 2.79 KB
/
test.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
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
123
124
125
126
127
#!/bin/sh
_ROOT_DIR_="`cd -- $(dirname -- $0) && pwd`"
_TEST_="${_TEST_:-basic}"
_CFG_OPT_="${_CFG_OPT_}"
_OS_NAME_="`uname -s 2>/dev/null`"
_WIN_ENV_=
_WIN_ENV_MSVC_=
case "$_OS_NAME_" in
MSYS_NT-*|MINGW??_NT-*) _OS_NAME_="WinNT" ;;
esac
CC="${CC}"
if [ -z "$CC" ]; then
case "$_OS_NAME_" in
Darwin) CC="clang" ;;
Linux) CC="gcc" ;;
WinNT) CC="cl" ;;
esac
fi
# switch to ROOT
cd "${_ROOT_DIR_}"
# check nore
if [ ! -f "${_ROOT_DIR_%/}/configure" ]; then
curl -O "https://raw.githubusercontent.com/junjiemars/nore/edge/bootstrap.sh"
if [ 0 -ne $? ] || [ ! -f bootstrap.sh ]; then
echo "!panic: install Nore failed"
exit 1
fi
sh bootstrap.sh --branch=edge
rm bootstrap.sh
fi
# check cc-env for cl
if [ "WinNT" = "${_OS_NAME_}" -a "cl" = "${CC}" ]; then
if [ ! -f "${HOME}/.nore/cc-env.sh" ]; then
echo "!panic: ${HOME}/.nore/cc-env.sh no found"
exit 1
fi
${HOME}/.nore/cc-env.sh 1
if [ ! -f "${HOME}/.nore/cc-env.bat" ]; then
echo "!panic: ${HOME}/.nore/cc-env.bat no found"
exit 1
fi
cat << END > "${HOME}/msvc.bat"
@if not "%VSCMD_DEBUG%" GEQ "3" echo off
REM generated by Nore (https://github.com/junjiemars/nore)
call "%1"
sh "%2"
"%3"
END
if [ ! -f "${HOME}/msvc.bat" ]; then
echo "!panic: generate ${HOME}/msvc.bat failed"
exit 1
fi
_WIN_ENV_MSVC_="${HOME}/msvc.bat"
chmod u+x "${_WIN_ENV_MSVC_}"
_WIN_ENV_="${HOME}/.nore/cc-env.bat"
fi
test_do() {
local rc=0
local cfg="$_CFG_OPT_ $*"
echo "------------"
echo "# $*"
if [ -z "$_WIN_ENV_" ]; then
echo "# ${_ROOT_DIR_%/}/configure $cfg"
echo "------------"
${_ROOT_DIR_%/}/configure $cfg
make test
else
echo "# ${_WIN_ENV_MSVC_} $_WIN_ENV_ ./configure $cfg"
echo "------------"
${_WIN_ENV_MSVC_} "$_WIN_ENV_" "./configure $cfg" "make test"
fi
rc=$?
if [ 0 -ne $rc ]; then
echo "------------"
echo "! $@ <failed>"
echo "# dump out/auto.err ..."
cat out/auto.err
echo "------------"
echo "# dump out/nore.h ..."
cat out/nore.h
fi
return $rc
}
# basic test
if [ "basic" = "$_TEST_" ]; then
test_do --has-posix
test_do --has-algo
# # test_do --has-cpu
# test_do --has-ctl
# test_do --has-data
test_do --has-ds
# test_do --has-ffi
# test_do --has-flex
# test_do --has-hi
# test_do --has-io
test_do --has-lang
# test_do --has-leptonica
# test_do --has-library
# test_do --has-libgccjit
# test_do --has-limit
# test_do --has-mach
# test_do --has-nginx
# test_do --has-net
# test_do --has-os
# test_do --has-parallel
# test_do --has-redis
# test_do --has-regexp
# test_do --has-signal
# test_do --has-stdio
# test_do --has-stdio1
# test_do --has-unicode
# test_do --has-uv --with-std=no
# test_do --has-webassembly --with-std=no
# test_do --has-x86
fi
echo "!completed"
# eof