ci: fix more failing tests

pull/13261/head
Delyan Angelov 2022-01-22 22:35:18 +02:00
parent 9057e9f1dd
commit 359b674cff
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
13 changed files with 19 additions and 18 deletions

View File

@ -210,8 +210,9 @@ fn get_all_commands() []Command {
rmfile: 'examples/tetris/tetris' rmfile: 'examples/tetris/tetris'
} }
$if macos || linux { $if macos || linux {
ipath := '$vroot/thirdparty/stdatomic/nix'
res << Command{ res << Command{
line: '$vexe -o v.c cmd/v && cc -Werror -I "$vroot/thirdparty/stdatomic/nix" v.c -lpthread -lm && rm -rf a.out' line: '$vexe -o v.c cmd/v && cc -Werror -I ${os.quoted_path(ipath)} v.c -lpthread -lm && rm -rf a.out'
label: 'v.c should be buildable with no warnings...' label: 'v.c should be buildable with no warnings...'
okmsg: 'v.c can be compiled without warnings. This is good :)' okmsg: 'v.c can be compiled without warnings. This is good :)'
rmfile: 'v.c' rmfile: 'v.c'

View File

@ -6,7 +6,7 @@ fn test_all_samples_can_be_compiled() {
samples := os.walk_ext('$vroot/vlib/gg/testdata', '.vv') samples := os.walk_ext('$vroot/vlib/gg/testdata', '.vv')
mut fails := []string{} mut fails := []string{}
for program_source in samples { for program_source in samples {
compile_cmd := '"$vexe" "$program_source"' compile_cmd := '${os.quoted_path(vexe)} ${os.quoted_path(program_source)}'
res := os.execute(compile_cmd) res := os.execute(compile_cmd)
if res.exit_code != 0 { if res.exit_code != 0 {
eprintln('>>> FAIL $compile_cmd') eprintln('>>> FAIL $compile_cmd')

View File

@ -295,7 +295,7 @@ fn (mut task TaskDescription) execute() {
return return
} }
program := task.path program := task.path
cli_cmd := '$task.vexe $task.voptions $program' cli_cmd := '${os.quoted_path(task.vexe)} $task.voptions ${os.quoted_path(program)}'
res := os.execute(cli_cmd) res := os.execute(cli_cmd)
expected_out_path := program.replace('.vv', '') + task.result_extension expected_out_path := program.replace('.vv', '') + task.result_extension
task.expected_out_path = expected_out_path task.expected_out_path = expected_out_path

View File

@ -24,7 +24,7 @@ fn test_interpret() ? {
full_test_path := os.real_path(os.join_path(dir, test)) full_test_path := os.real_path(os.join_path(dir, test))
test_file_name := os.file_name(test) test_file_name := os.file_name(test)
relative_test_path := full_test_path.replace(vroot + '/', '') relative_test_path := full_test_path.replace(vroot + '/', '')
cmd := '"$vexe" interpret "$full_test_path"' cmd := '${os.quoted_path(vexe)} interpret ${os.quoted_path(full_test_path)}'
if is_verbose { if is_verbose {
println(cmd) println(cmd)
} }

View File

@ -36,7 +36,7 @@ fn test_native() {
relative_test_path := full_test_path.replace(vroot + '/', '') relative_test_path := full_test_path.replace(vroot + '/', '')
work_test_path := '$wrkdir/$test_file_name' work_test_path := '$wrkdir/$test_file_name'
exe_test_path := '$wrkdir/${test_file_name}.exe' exe_test_path := '$wrkdir/${test_file_name}.exe'
cmd := '"$vexe" -o "$exe_test_path" -b native "$full_test_path"' cmd := '${os.quoted_path(vexe)} -o ${os.quoted_path(exe_test_path)} -b native ${os.quoted_path(full_test_path)}'
if is_verbose { if is_verbose {
println(cmd) println(cmd)
} }
@ -47,7 +47,7 @@ fn test_native() {
continue continue
} }
tmperrfile := '$dir/${test}.tmperr' tmperrfile := '$dir/${test}.tmperr'
res := os.execute('$exe_test_path 2> $tmperrfile') res := os.execute('${os.quoted_path(exe_test_path)} 2> ${os.quoted_path(tmperrfile)}')
if res.exit_code != 0 { if res.exit_code != 0 {
bench.fail() bench.fail()
eprintln(bench.step_message_fail('$full_test_path failed to run')) eprintln(bench.step_message_fail('$full_test_path failed to run'))

View File

@ -66,7 +66,7 @@ fn compile_and_reload_shared_lib(mut r live.LiveReloadInfo) ?bool {
fn compile_lib(mut r live.LiveReloadInfo) ?string { fn compile_lib(mut r live.LiveReloadInfo) ?string {
new_lib_path, new_lib_path_with_extension := current_shared_library_path(mut r) new_lib_path, new_lib_path_with_extension := current_shared_library_path(mut r)
cmd := '$r.vexe $r.vopts -o $new_lib_path $r.original' cmd := '${os.quoted_path(r.vexe)} $r.vopts -o ${os.quoted_path(new_lib_path)} ${os.quoted_path(r.original)}'
elog(r, '> compilation cmd: $cmd') elog(r, '> compilation cmd: $cmd')
cwatch := time.new_stopwatch() cwatch := time.new_stopwatch()
recompilation_result := os.execute(cmd) recompilation_result := os.execute(cmd)

View File

@ -688,7 +688,7 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin
mut output_option := '' mut output_option := ''
if tmp_exe_file_path == '' { if tmp_exe_file_path == '' {
tmp_exe_file_path = '${tmp_file_path}.exe' tmp_exe_file_path = '${tmp_file_path}.exe'
output_option = '-o "$tmp_exe_file_path"' output_option = '-o ${os.quoted_path(tmp_exe_file_path)} '
} }
tmp_v_file_path := '${tmp_file_path}.v' tmp_v_file_path := '${tmp_file_path}.v'
contents := os.get_raw_lines_joined() contents := os.get_raw_lines_joined()
@ -698,7 +698,7 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin
run_options := cmdline.options_before(args, ['run']).join(' ') run_options := cmdline.options_before(args, ['run']).join(' ')
command_options := cmdline.options_after(args, ['run'])[1..].join(' ') command_options := cmdline.options_after(args, ['run'])[1..].join(' ')
vexe := vexe_path() vexe := vexe_path()
tmp_cmd := '"$vexe" $output_option $run_options run "$tmp_v_file_path" $command_options' tmp_cmd := '${os.quoted_path(vexe)} $output_option $run_options run ${os.quoted_path(tmp_v_file_path)} $command_options'
// //
res.vrun_elog('tmp_cmd: $tmp_cmd') res.vrun_elog('tmp_cmd: $tmp_cmd')
tmp_result := os.system(tmp_cmd) tmp_result := os.system(tmp_cmd)

View File

@ -9,7 +9,7 @@ fn vroot_path(relpath string) string {
} }
fn vrun_ok(options string, path string) string { fn vrun_ok(options string, path string) string {
cmd := '${@VEXE} $options $path' cmd := '${os.quoted_path(@VEXE)} $options ${os.quoted_path(path)}'
res := os.execute(cmd) res := os.execute(cmd)
if res.exit_code != 0 { if res.exit_code != 0 {
eprintln('> failing vrun cmd: $cmd') eprintln('> failing vrun cmd: $cmd')

View File

@ -11,11 +11,11 @@ fn test_the_v_compiler_can_be_invoked() {
vexec := runner.full_path_to_v(5) vexec := runner.full_path_to_v(5)
println('vexecutable: $vexec') println('vexecutable: $vexec')
assert vexec != '' assert vexec != ''
vcmd := '"$vexec" -version' vcmd := '${os.quoted_path(vexec)} -version'
r := os.execute_or_exit(vcmd) r := os.execute_or_exit(vcmd)
assert r.exit_code == 0 assert r.exit_code == 0
// println('"$vcmd" exit_code: $r.exit_code | output: $r.output') // println('"$vcmd" exit_code: $r.exit_code | output: $r.output')
vcmd_error := '"$vexec" nonexisting.v' vcmd_error := '${os.quoted_path(vexec)} nonexisting.v'
r_error := os.execute(vcmd_error) r_error := os.execute(vcmd_error)
if r_error.exit_code < 0 { if r_error.exit_code < 0 {
panic(r_error.output) panic(r_error.output)

View File

@ -49,7 +49,7 @@ pub fn run_repl_file(wd string, vexec string, file string) ?string {
input_temporary_filename := os.real_path(os.join_path(wd, 'input_temporary_filename.txt')) input_temporary_filename := os.real_path(os.join_path(wd, 'input_temporary_filename.txt'))
os.write_file(input_temporary_filename, input) or { panic(err) } os.write_file(input_temporary_filename, input) or { panic(err) }
os.write_file(os.real_path(os.join_path(wd, 'original.txt')), fcontent) or { panic(err) } os.write_file(os.real_path(os.join_path(wd, 'original.txt')), fcontent) or { panic(err) }
rcmd := '"$vexec" repl -replfolder "$wd" -replprefix "${fname}." < $input_temporary_filename' rcmd := '${os.quoted_path(vexec)} repl -replfolder ${os.quoted_path(wd)} -replprefix "${fname}." < ${os.quoted_path(input_temporary_filename)}'
r := os.execute(rcmd) r := os.execute(rcmd)
if r.exit_code < 0 { if r.exit_code < 0 {
os.rm(input_temporary_filename) ? os.rm(input_temporary_filename) ?
@ -84,7 +84,7 @@ pub fn run_prod_file(wd string, vexec string, file string) ?string {
return error('Could not read expected prod file $file_expected') return error('Could not read expected prod file $file_expected')
} }
expected_content := f_expected_content.replace('\r', '') expected_content := f_expected_content.replace('\r', '')
cmd := '"$vexec" -prod run "$file"' cmd := '${os.quoted_path(vexec)} -prod run ${os.quoted_path(file)}'
r := os.execute(cmd) r := os.execute(cmd)
if r.exit_code < 0 { if r.exit_code < 0 {
return error('Could not execute: $cmd') return error('Could not execute: $cmd')

View File

@ -14,7 +14,7 @@ fn pipe_to_v_run() ? {
// eprintln('>>> tmp_v_file: $tmp_v_file') // eprintln('>>> tmp_v_file: $tmp_v_file')
os.write_file(tmp_v_file, 'println(1 + 3)\nprintln("hello")\n') ? os.write_file(tmp_v_file, 'println(1 + 3)\nprintln("hello")\n') ?
assert os.is_file(tmp_v_file) assert os.is_file(tmp_v_file)
cmd := '$cat_cmd "$tmp_v_file" | "$vexe" run -' cmd := '$cat_cmd ${os.quoted_path(tmp_v_file)} | ${os.quoted_path(vexe)} run -'
res := os.execute(cmd) res := os.execute(cmd)
// eprintln('>> cmd: $cmd | res: $res') // eprintln('>> cmd: $cmd | res: $res')
assert res.exit_code == 0 assert res.exit_code == 0

View File

@ -85,7 +85,7 @@ fn test_all() {
base_filename := os.file_name(test).replace('.v', '') base_filename := os.file_name(test).replace('.v', '')
exe_filename := '$wrkdir/$base_filename' exe_filename := '$wrkdir/$base_filename'
full_path_to_source_file := os.join_path(vroot, test) full_path_to_source_file := os.join_path(vroot, test)
compile_cmd := '"$vexe" -o "$exe_filename" -cg -cflags "-w" -experimental -autofree "$full_path_to_source_file"' compile_cmd := '${os.quoted_path(vexe)} -o ${os.quoted_path(exe_filename)} -cg -cflags "-w" -experimental -autofree ${os.quoted_path(full_path_to_source_file)}'
vprintln('compile cmd: ${bold(compile_cmd)}') vprintln('compile cmd: ${bold(compile_cmd)}')
res := os.execute(compile_cmd) res := os.execute(compile_cmd)
if res.exit_code != 0 { if res.exit_code != 0 {
@ -102,7 +102,7 @@ fn test_all() {
continue continue
} }
} }
valgrind_cmd := 'valgrind --error-exitcode=1 --leak-check=full "$exe_filename"' valgrind_cmd := 'valgrind --error-exitcode=1 --leak-check=full ${os.quoted_path(exe_filename)}'
vprintln('valgrind cmd: ${bold(valgrind_cmd)}') vprintln('valgrind cmd: ${bold(valgrind_cmd)}')
valgrind_res := os.execute(valgrind_cmd) valgrind_res := os.execute(valgrind_cmd)
if valgrind_res.exit_code != 0 { if valgrind_res.exit_code != 0 {

View File

@ -178,7 +178,7 @@ pub fn launch_tool(is_verbose bool, tool_name string, args []string) {
exit(os.system('${os.quoted_path(tool_exe)} $tool_args')) exit(os.system('${os.quoted_path(tool_exe)} $tool_args'))
} $else $if js { } $else $if js {
// no way to implement os.execvp in JS backend // no way to implement os.execvp in JS backend
exit(os.system('${os.quote_path(tool_exe)} $tool_args')) exit(os.system('$tool_exe $tool_args'))
} $else { } $else {
os.execvp(tool_exe, args) or { panic(err) } os.execvp(tool_exe, args) or { panic(err) }
} }