forked from smooth80/defold
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwscript
114 lines (90 loc) · 3.76 KB
/
wscript
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
#! /usr/bin/env python
VERSION = '0.1'
APPNAME = 'dlib'
srcdir = '.'
blddir = 'build'
import Options
import os, sys, tempfile, ConfigParser
import waf_dynamo
from BuildUtility import BuildUtility, BuildUtilityException, create_build_utility
def init():
pass
def set_options(opt):
opt.tool_options('waf_dynamo')
opt.sub_options('src')
def configure(conf):
conf.check_tool('waf_dynamo')
conf.sub_config('src')
conf.check_tool('java')
build_util = None
try:
build_util = create_build_utility(conf.env)
except BuildUtilityException as ex:
conf.fatal(ex.msg)
conf.env.append_value('CPPPATH', build_util.get_dynamo_ext('include'))
conf.env.append_value('LIBPATH', build_util.get_dynamo_ext('lib', build_util.get_target_platform()))
conf.env.append_unique('CCDEFINES', 'DLIB_LOG_DOMAIN="DLIB"')
conf.env.append_unique('CXXDEFINES', 'DLIB_LOG_DOMAIN="DLIB"')
def build(bld):
if not os.path.exists('tmp'):
os.mkdir('tmp')
bld.add_subdirs('src')
bld.install_files('${PREFIX}/include/x86_64-win32', 'include/x86_64-win32/*.h')
def shutdown():
if not Options.commands['build'] or getattr(Options.options, 'skip_tests', False):
return
# TODO: Fix support for win32
from Logs import warn, error
import urllib2, time, atexit
server_sockets = None
if sys.platform != 'win32':
os.system('scripts/start_http_server.sh')
atexit.register(os.system, 'scripts/stop_http_server.sh')
server_config_path = "test_http_server.cfg"
if os.path.exists(server_config_path):
os.unlink(server_config_path)
start = time.time()
while True:
if time.time() - start > 5:
error('HTTP server failed to start within 5 seconds')
sys.exit(1)
try:
if not os.path.exists(server_config_path):
raise IOError("Waiting for server to write config file")
server_sockets = ConfigParser.RawConfigParser()
server_sockets.read(server_config_path)
server_socket = server_sockets.getint("server", "socket")
urllib2.urlopen('http://localhost:%d' % server_socket)
break
except IOError:
print('Waiting for HTTP testserver to start')
except urllib2.URLError:
print('Waiting for HTTP testserver to start on port %d...' % server_socket)
sys.stdout.flush()
time.sleep(0.5)
else:
warn('HTTP tests not supported on Win32 yet')
# write a config file for the tests to use
config = ConfigParser.RawConfigParser()
if sys.platform != 'win32':
config.add_section("server")
config.set("server", "socket", server_sockets.getint("server", "socket"))
config.set("server", "socket_ssl", server_sockets.getint("server", "socket_ssl"))
config.set("server", "socket_ssl_test", server_sockets.getint("server", "socket_ssl_test"))
configfilepath = os.path.basename(tempfile.mktemp(".cfg", "unittest_"))
with open(configfilepath, 'wb') as f:
config.write(f)
print("Wrote test config file: %s" % configfilepath)
try:
waf_dynamo.run_tests(valgrind = True, configfile = configfilepath)
finally:
os.remove(configfilepath)
# The test should work on OSX, but the CI (Catalina) just crashed with no callstack (even in lldb)
# Postponing a fix until I've updated to Catalina on my machine as well
if not sys.platform in ('win32', 'darwin'):
import subprocess
proc = subprocess.Popen('./scripts/run_test_memprofile.sh', shell = True)
ret = proc.wait()
if ret != 0:
print("test failed test_memprofile")
sys.exit(ret)