tests: make profile_test.v more robust

pull/8931/head
Delyan Angelov 2021-02-23 18:30:35 +02:00
parent 864b5ee40b
commit ecef42832a
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 10 additions and 15 deletions

View File

@ -1,9 +1,8 @@
import os import os
const ( const vexe = os.getenv('VEXE')
vexe = os.getenv('VEXE')
vroot = os.dir(vexe) const vroot = os.dir(vexe)
)
fn test_vexe_exists() { fn test_vexe_exists() {
assert vexe.len > 0 assert vexe.len > 0
@ -11,18 +10,14 @@ fn test_vexe_exists() {
} }
fn test_v_profile_works() { fn test_v_profile_works() {
res := os.exec('"$vexe" -profile - run vlib/v/tests/profile/calling_http_get.v') or { os.chdir(vroot)
panic(err) program_source := os.join_path(vroot, 'vlib/v/tests/profile/calling_http_get.v')
} res := os.exec('"$vexe" -profile - run $program_source') or { exit(1) }
// eprintln('res: $res') // eprintln('res: $res')
assert res.exit_code == 0 assert res.exit_code == 0
assert res.output.len > 0 assert res.output.len > 0
// assert res.output.starts_with('net: socket error') assert res.output.contains(' os__init_os_args')
// assert res.output.contains(' main__main') assert res.output.contains(' main__main')
// assert res.output.contains(' os__init_os_args') assert res.output.contains(' println')
// TODO: fix this. not sure whats happening here assert res.output.contains(' net__http__get')
if !res.output.starts_with('net: socket error') {
assert res.output.contains(' main__main')
assert res.output.contains(' os__init_os_args')
}
} }