mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
os,tools: make easier analyzing process_test.v failures on the CI
This commit is contained in:
parent
f7f89b3c3c
commit
175b0fa415
@ -88,9 +88,11 @@ fn main() {
|
||||
}
|
||||
}
|
||||
spawn do_timeout(&ctx)
|
||||
ctx.println('start')
|
||||
for i := 1; true; i++ {
|
||||
ctx.println('${i}')
|
||||
time.sleep(ctx.period_ms * time.millisecond)
|
||||
}
|
||||
ctx.println('done')
|
||||
time.sleep(100 * time.second)
|
||||
}
|
||||
|
@ -27,12 +27,14 @@ fn testsuite_end() {
|
||||
}
|
||||
|
||||
fn test_getpid() {
|
||||
eprintln(@FN)
|
||||
pid := os.getpid()
|
||||
eprintln('current pid: ${pid}')
|
||||
assert pid != 0
|
||||
}
|
||||
|
||||
fn test_set_work_folder() {
|
||||
eprintln(@FN)
|
||||
new_work_folder := os.real_path(os.temp_dir())
|
||||
parent_working_folder := os.getwd()
|
||||
dump(new_work_folder)
|
||||
@ -62,6 +64,7 @@ fn test_set_work_folder() {
|
||||
}
|
||||
|
||||
fn test_set_environment() {
|
||||
eprintln(@FN)
|
||||
mut p := os.new_process(test_os_process)
|
||||
p.set_args(['-show_env', '-target', 'stdout'])
|
||||
p.set_environment({
|
||||
@ -75,11 +78,11 @@ fn test_set_environment() {
|
||||
$if trace_process_output ? {
|
||||
eprintln('p output: "${output}"')
|
||||
}
|
||||
dump(output)
|
||||
assert output.contains('V_OS_TEST_PORT=1234567890')
|
||||
assert output.contains('V_OS_TEST_PORT=1234567890'), output
|
||||
}
|
||||
|
||||
fn test_run() {
|
||||
eprintln(@FN)
|
||||
mut p := os.new_process(test_os_process)
|
||||
p.set_args(['-timeout_ms', '150', '-period_ms', '50'])
|
||||
p.run()
|
||||
@ -107,6 +110,7 @@ fn test_run() {
|
||||
}
|
||||
|
||||
fn test_wait() {
|
||||
eprintln(@FN)
|
||||
mut p := os.new_process(test_os_process)
|
||||
assert p.status != .exited
|
||||
p.wait()
|
||||
@ -117,8 +121,9 @@ fn test_wait() {
|
||||
}
|
||||
|
||||
fn test_slurping_output() {
|
||||
eprintln(@FN)
|
||||
mut p := os.new_process(test_os_process)
|
||||
p.set_args(['-timeout_ms', '500', '-period_ms', '50'])
|
||||
p.set_args(['-timeout_ms', '600', '-period_ms', '50'])
|
||||
p.set_redirect_stdio()
|
||||
assert p.status != .exited
|
||||
p.wait()
|
||||
@ -133,15 +138,12 @@ fn test_slurping_output() {
|
||||
eprintln('p errors: "${errors}"')
|
||||
eprintln('---------------------------')
|
||||
}
|
||||
// dump(output)
|
||||
assert output.contains('stdout, 1')
|
||||
assert output.contains('stdout, 2')
|
||||
assert output.contains('stdout, 3')
|
||||
assert output.contains('stdout, 4')
|
||||
|
||||
// dump(errors)
|
||||
assert errors.contains('stderr, 1')
|
||||
assert errors.contains('stderr, 2')
|
||||
assert errors.contains('stderr, 3')
|
||||
assert errors.contains('stderr, 4')
|
||||
assert output.contains('stdout, 1'), output
|
||||
assert output.contains('stdout, 2'), output
|
||||
assert output.contains('stdout, 3'), output
|
||||
assert output.contains('stdout, 4'), output
|
||||
assert errors.contains('stderr, 1'), errors
|
||||
assert errors.contains('stderr, 2'), errors
|
||||
assert errors.contains('stderr, 3'), errors
|
||||
assert errors.contains('stderr, 4'), errors
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user