ci: fix compiler_errors_test.v too

pull/13261/head
Delyan Angelov 2022-01-22 23:45:48 +02:00
parent 359b674cff
commit fba9587323
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 13 additions and 3 deletions

View File

@ -28,6 +28,7 @@ const github_job = os.getenv('GITHUB_JOB')
struct TaskDescription {
vexe string
evars string
dir string
voptions string
result_extension string
@ -115,9 +116,9 @@ fn test_all() {
cte_dir := '$checker_dir/comptime_env'
files := get_tests_in_dir(cte_dir, false)
cte_tasks.add('', cte_dir, '-no-retry-compilation run', '.run.out', files, false)
cte_tasks.add('VAR=/usr/include $vexe', cte_dir, '-no-retry-compilation run',
cte_tasks.add_evars('VAR=/usr/include', '', cte_dir, '-no-retry-compilation run',
'.var.run.out', ['using_comptime_env.vv'], false)
cte_tasks.add('VAR=/opt/invalid/path $vexe', cte_dir, '-no-retry-compilation run',
cte_tasks.add_evars('VAR=/opt/invalid/path', '', cte_dir, '-no-retry-compilation run',
'.var_invalid.run.out', ['using_comptime_env.vv'], false)
cte_tasks.run()
}
@ -157,6 +158,10 @@ fn (mut tasks Tasks) add_checked_run(voptions string, result_extension string, t
}
fn (mut tasks Tasks) add(custom_vexe string, dir string, voptions string, result_extension string, tests []string, is_module bool) {
tasks.add_evars('', custom_vexe, dir, voptions, result_extension, tests, is_module)
}
fn (mut tasks Tasks) add_evars(evars string, custom_vexe string, dir string, voptions string, result_extension string, tests []string, is_module bool) {
mut vexe := tasks.vexe
if custom_vexe != '' {
vexe = custom_vexe
@ -164,6 +169,7 @@ fn (mut tasks Tasks) add(custom_vexe string, dir string, voptions string, result
paths := vtest.filter_vtest_only(tests, basepath: dir)
for path in paths {
tasks.all << TaskDescription{
evars: evars
vexe: vexe
dir: dir
voptions: voptions
@ -295,7 +301,8 @@ fn (mut task TaskDescription) execute() {
return
}
program := task.path
cli_cmd := '${os.quoted_path(task.vexe)} $task.voptions ${os.quoted_path(program)}'
cmd_prefix := if task.evars.len > 0 { '$task.evars ' } else { '' }
cli_cmd := '$cmd_prefix${os.quoted_path(task.vexe)} $task.voptions ${os.quoted_path(program)}'
res := os.execute(cli_cmd)
expected_out_path := program.replace('.vv', '') + task.result_extension
task.expected_out_path = expected_out_path

View File

@ -20,6 +20,9 @@ fn vrun_ok(options string, path string) string {
}
fn test_projects_should_run() {
$if windows {
return
}
res := vrun_ok('run', vroot_path('vlib/v/tests/testdata/enum_in_builtin') + os.path_separator)
assert res.trim_space() == 'v0'
}