v2 / vlib / v / slow_tests / run_project_folders_test.v
39 lines · 35 sloc · 1.06 KB · e2e5cf8db56f3562c7baa735061690be936bdf3e
Raw
1// vtest build: tinyc
2import os
3import time
4import term
5
6const vexe = os.getenv('VEXE')
7
8const vroot = os.dir(vexe)
9
10fn test_vexe_exists() {
11 assert vexe.len > 0
12 assert os.is_file(vexe)
13}
14
15fn test_v_profile_works() {
16 os.chdir(vroot) or {}
17 folders_root := os.join_path(vroot, 'vlib/v/slow_tests/run_project_folders')
18 folder_names := os.ls(folders_root)!
19 mut folder_paths := []string{}
20 for fname in folder_names {
21 folder_path := os.join_path(folders_root, fname)
22 if os.is_dir(folder_path) {
23 folder_paths << folder_path
24 }
25 }
26 for folder_path in folder_paths {
27 local_path := folder_path.replace(vroot + os.path_separator, '').replace('\\', '/')
28 println('........... v run ${local_path}/')
29 t := time.ticks()
30 res := os.execute('${os.quoted_path(vexe)} run ${os.quoted_path(folder_path)}')
31 delta := time.ticks() - t
32 // eprintln('res: ${res}')
33 assert res.exit_code == 0, 'failing res: ${res}'
34 assert res.output.len > 0
35 assert res.output.contains('OK')
36 term.clear_previous_line()
37 println('${term.bold('OK')} in ${delta:4}ms v run ${local_path}/')
38 }
39}
40