tests: reduce probability of locks during macos runs of live_test.v
							parent
							
								
									d77669da80
								
							
						
					
					
						commit
						06a02c41c3
					
				|  | @ -52,7 +52,6 @@ fn append_to_file(fname, s string) { | |||
| 	f.writeln('\$s') | ||||
| 	//info := live.info()
 | ||||
| 	//f.writeln('>>> reloads: \${info.reloads} | ok reloads: \${info.reloads_ok}')
 | ||||
| 	f.flush() | ||||
| 	f.close() | ||||
| } | ||||
| 
 | ||||
|  | @ -64,13 +63,11 @@ fn myprintln(s string) { | |||
| 
 | ||||
| [live] | ||||
| fn pmessage() string { | ||||
| 	s := 'ORIGINAL' | ||||
| 	myprintln(s) | ||||
| 	return s | ||||
| 	return 'ORIGINAL' | ||||
| } | ||||
| 
 | ||||
| const ( | ||||
| 	delay = 5 | ||||
| 	delay = 20 | ||||
| ) | ||||
| fn edefault(name string, default string) string { | ||||
| 	res := os.getenv(name) | ||||
|  | @ -87,14 +84,15 @@ fn main() { | |||
| 	pmessage() | ||||
| 	pmessage() | ||||
| 	max_cycles := edefault('LIVE_CYCLES', '1').int() | ||||
| 	// NB: 1000 * 5 = maximum of ~5s runtime
 | ||||
| 	// NB: 1000 * 20 = maximum of ~20s runtime
 | ||||
| 	for i:=0; i<max_cycles; i++ { | ||||
| 		s := pmessage() | ||||
| 		myprintln(s) | ||||
| 		append_to_file(os.resource_abs_path(s + '.txt'), s) | ||||
| 		time.sleep_ms(delay) | ||||
| 		if s == 'STOP' { | ||||
| 			break | ||||
| 		} | ||||
| 		time.sleep_ms(delay) | ||||
| 	} | ||||
| 	pmessage() | ||||
| 	pmessage() | ||||
|  | @ -192,8 +190,8 @@ fn setup_cycles_environment() { | |||
| 	mut max_live_cycles := 1000 | ||||
| 	mut max_wait_cycles := 400 | ||||
| 	if os.user_os() == 'macos' { | ||||
| 		max_live_cycles *= 5 | ||||
| 		max_wait_cycles *= 5 | ||||
| //		max_live_cycles *= 5
 | ||||
| //		max_wait_cycles *= 5
 | ||||
| 	} | ||||
| 	os.setenv('LIVE_CYCLES', '$max_live_cycles', true) | ||||
| 	os.setenv('WAIT_CYCLES', '$max_wait_cycles', true) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue