Merge pull request #10821 from blueyed/asan

tests: improve escaping of special chars, forward all sanitizer options
This commit is contained in:
Daniel Hahler 2019-08-21 03:21:50 +02:00 committed by GitHub
commit 0e8ee37efd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -7,6 +7,13 @@ function s:logger.on_exit(id, data, event)
call add(self.d_events, [a:event, ['']])
endfunction
" Replace non-printable chars by special sequence, or "<%x>".
let s:escaped_char = {"\n": '\n', "\r": '\r', "\t": '\t'}
function! s:escape_non_printable(char) abort
let r = get(s:escaped_char, a:char)
return r is 0 ? printf('<%x>', char2nr(a:char)) : r
endfunction
function Main()
let argc = +$NVIM_TEST_ARGC
let args = []
@ -26,9 +33,8 @@ function Main()
\'join(map(v:val[1], '.
\ '''substitute(v:val, '.
\ '"\\v\\C(\\p@!.|\\<)", '.
\ '"\\=printf(\"<%x>\", '.
\ 'char2nr(submatch(0)))", '.
\ '"")''), '.
\ '"\\=s:escape_non_printable(submatch(0))", '.
\ '"g")''), '.
\ '''\n'')')
call setline(1, [
\ 'Job exited with code ' . results[0],

View File

@ -445,6 +445,8 @@ function module.new_argv(...)
for _, k in ipairs({
'HOME',
'ASAN_OPTIONS',
'TSAN_OPTIONS',
'MSAN_OPTIONS',
'LD_LIBRARY_PATH',
'PATH',
'NVIM_LOG_FILE',