Convert test-launcher into a generic asan-launcher so that it can be used to run kitty as well
This commit is contained in:
parent
96f85b187e
commit
04a61d0e21
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,7 +5,7 @@ tags
|
||||
build
|
||||
linux-package
|
||||
logo/*.iconset
|
||||
test-launcher
|
||||
asan-launcher
|
||||
kitty-profile
|
||||
dev
|
||||
__pycache__
|
||||
|
||||
@ -114,9 +114,8 @@ install: |
|
||||
before_script:
|
||||
- echo $LD_LIBRARY_PATH
|
||||
- $PYTHON setup.py build --debug $SANITIZE_ARG;
|
||||
- if [[ "$TRAVIS_OS_NAME" != 'osx' ]]; then ldd ./test-launcher `which $PYTHON`; fi
|
||||
|
||||
script:
|
||||
- ./test-launcher
|
||||
- if [[ -z $SANITIZE_ARG ]]; then $PYTHON test.py; else ./asan-launcher test; fi
|
||||
- if [[ "$RUN_FLAKE" == "1" ]]; then flake8 --count .; fi
|
||||
- if [[ "$BUILD_PKG" == "1" ]]; then $PYTHON setup.py linux-package; fi
|
||||
|
||||
17
asan-launcher.c
Normal file
17
asan-launcher.c
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* linux-launcher.c
|
||||
* Copyright (C) 2017 Kovid Goyal <kovid at kovidgoyal.net>
|
||||
*
|
||||
* Distributed under terms of the GPL3 license.
|
||||
*/
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#define MAX_ARGC 1024
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
wchar_t *argvw[MAX_ARGC + 1] = {0};
|
||||
argvw[0] = L"kitty";
|
||||
for (int i = 1; i < argc; i++) argvw[i] = Py_DecodeLocale(argv[i], NULL);
|
||||
return Py_Main(argc, argvw);
|
||||
}
|
||||
16
setup.py
16
setup.py
@ -333,15 +333,17 @@ def safe_makedirs(path):
|
||||
os.makedirs(path, exist_ok=True)
|
||||
|
||||
|
||||
def build_test_launcher(args):
|
||||
def build_asan_launcher(args):
|
||||
dest = 'asan-launcher'
|
||||
src = 'asan-launcher.c'
|
||||
if args.incremental and not newer(dest, src):
|
||||
return
|
||||
cc, ccver = cc_version()
|
||||
cflags = '-g -Wall -Werror -fpie'.split()
|
||||
pylib = get_python_flags(cflags)
|
||||
sanitize_lib = (['-lasan'] if cc == 'gcc' else []) if args.sanitize else []
|
||||
cflags.extend(get_sanitize_args(cc, ccver) if args.sanitize else [])
|
||||
cmd = [cc] + cflags + [
|
||||
'test-launcher.c', '-o', 'test-launcher',
|
||||
] + sanitize_lib + pylib
|
||||
sanitize_lib = ['-lasan'] if cc == 'gcc' else []
|
||||
cflags.extend(get_sanitize_args(cc, ccver))
|
||||
cmd = [cc] + cflags + [src, '-o', dest] + sanitize_lib + pylib
|
||||
run_tool(cmd)
|
||||
|
||||
|
||||
@ -444,7 +446,7 @@ def main():
|
||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||
if args.action == 'build':
|
||||
build(args)
|
||||
build_test_launcher(args)
|
||||
build_asan_launcher(args)
|
||||
if args.profile:
|
||||
build_linux_launcher(args)
|
||||
print('kitty profile executable is', 'kitty-profile')
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
/*
|
||||
* linux-launcher.c
|
||||
* Copyright (C) 2017 Kovid Goyal <kovid at kovidgoyal.net>
|
||||
*
|
||||
* Distributed under terms of the GPL3 license.
|
||||
*/
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
wchar_t *wargv[2] = {L"kitty-test", L"test.py"};
|
||||
return Py_Main(2, wargv);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user