| 1 | // vtest build: tinyc |
| 2 | import os |
| 3 | import time |
| 4 | import term |
| 5 | |
| 6 | const vexe = os.getenv('VEXE') |
| 7 | |
| 8 | const vroot = os.dir(vexe) |
| 9 | |
| 10 | fn test_vexe_exists() { |
| 11 | assert vexe.len > 0 |
| 12 | assert os.is_file(vexe) |
| 13 | } |
| 14 | |
| 15 | fn 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 | |