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
|
build
|
||||||
linux-package
|
linux-package
|
||||||
logo/*.iconset
|
logo/*.iconset
|
||||||
test-launcher
|
asan-launcher
|
||||||
kitty-profile
|
kitty-profile
|
||||||
dev
|
dev
|
||||||
__pycache__
|
__pycache__
|
||||||
|
|||||||
@ -114,9 +114,8 @@ install: |
|
|||||||
before_script:
|
before_script:
|
||||||
- echo $LD_LIBRARY_PATH
|
- echo $LD_LIBRARY_PATH
|
||||||
- $PYTHON setup.py build --debug $SANITIZE_ARG;
|
- $PYTHON setup.py build --debug $SANITIZE_ARG;
|
||||||
- if [[ "$TRAVIS_OS_NAME" != 'osx' ]]; then ldd ./test-launcher `which $PYTHON`; fi
|
|
||||||
|
|
||||||
script:
|
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 [[ "$RUN_FLAKE" == "1" ]]; then flake8 --count .; fi
|
||||||
- if [[ "$BUILD_PKG" == "1" ]]; then $PYTHON setup.py linux-package; 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)
|
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()
|
cc, ccver = cc_version()
|
||||||
cflags = '-g -Wall -Werror -fpie'.split()
|
cflags = '-g -Wall -Werror -fpie'.split()
|
||||||
pylib = get_python_flags(cflags)
|
pylib = get_python_flags(cflags)
|
||||||
sanitize_lib = (['-lasan'] if cc == 'gcc' else []) if args.sanitize else []
|
sanitize_lib = ['-lasan'] if cc == 'gcc' else []
|
||||||
cflags.extend(get_sanitize_args(cc, ccver) if args.sanitize else [])
|
cflags.extend(get_sanitize_args(cc, ccver))
|
||||||
cmd = [cc] + cflags + [
|
cmd = [cc] + cflags + [src, '-o', dest] + sanitize_lib + pylib
|
||||||
'test-launcher.c', '-o', 'test-launcher',
|
|
||||||
] + sanitize_lib + pylib
|
|
||||||
run_tool(cmd)
|
run_tool(cmd)
|
||||||
|
|
||||||
|
|
||||||
@ -444,7 +446,7 @@ def main():
|
|||||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||||
if args.action == 'build':
|
if args.action == 'build':
|
||||||
build(args)
|
build(args)
|
||||||
build_test_launcher(args)
|
build_asan_launcher(args)
|
||||||
if args.profile:
|
if args.profile:
|
||||||
build_linux_launcher(args)
|
build_linux_launcher(args)
|
||||||
print('kitty profile executable is', 'kitty-profile')
|
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