Skip to content

Commit 1b0c8c9

Browse files
committed
Improve test output handling and directory management
Replaced os.real_path with os.abs_path and switched to os.mkdir_all for more robust directory creation in test helpers. Set output_mode to .silent in all test project configurations to suppress unnecessary output. Updated builder to use b.print for header dir logging and improved timer output formatting.
1 parent 516d606 commit 1b0c8c9

2 files changed

Lines changed: 26 additions & 7 deletions

File tree

modules/builder/builder.v

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ pub fn (mut b Builder) run() bool {
6565

6666
b.pref.header_dirs = b.pref.header_dirs.reverse()
6767

68-
$if !test {
69-
println("used header dirs ${b.pref.header_dirs}")
70-
}
68+
b.print("used header dirs ${b.pref.header_dirs}")
7169

7270
b.files, b.files_names = find_all_src_files(b.pref.paths)
7371

@@ -144,7 +142,7 @@ fn (mut b Builder) start_timer(name string) {
144142
fn (mut b Builder) print_timer(name string) {
145143
if sw := b.timers[name] {
146144
time_ms := f32(sw.elapsed().microseconds()) / 1000
147-
b.print('$name: $time_ms ms')
145+
b.print('${name}: ${time_ms} ms')
148146
b.timers.delete(name)
149147
}
150148
else {

modules/tests/projects_test.v

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import pref
55
import builder
66

77
fn get_source_dir(dir_name string, required_file_name string) string {
8-
path := os.real_path(os.join_path("modules", "tests", dir_name))
8+
path := os.abs_path(os.join_path("modules", "tests", dir_name))
99
required_file := os.join_path(path, required_file_name)
1010

1111
if !os.is_dir(path) || !os.is_file(required_file) {
@@ -16,10 +16,10 @@ fn get_source_dir(dir_name string, required_file_name string) string {
1616
}
1717

1818
fn get_output_dir(dir_name string) string {
19-
path := os.real_path(os.join_path("test-files", "compiled", dir_name))
19+
path := os.abs_path(os.join_path("test-files", "compiled", dir_name))
2020

2121
if !os.is_dir(path) {
22-
os.mkdir(path, os.MkdirParams{}) or { assert false, "[get_output_dir] failed to create output folder ${path}" }
22+
os.mkdir_all(path, os.MkdirParams{}) or { assert false, "[get_output_dir] failed to create output folder ${path}; error: ${err}" }
2323
}
2424

2525
if !os.is_dir(path) {
@@ -36,6 +36,7 @@ fn test_project_skyrim_deps_sources() {
3636
mode: .compile
3737
backend: .check
3838
no_cache: true
39+
output_mode: .silent
3940
header_dirs: [ ]
4041
}
4142

@@ -49,6 +50,7 @@ fn test_project_skyui_sdk_51() {
4950
mode: .compile
5051
backend: .check
5152
no_cache: true
53+
output_mode: .silent
5254
header_dirs: [ get_source_dir("psc_deps", "Form.psc") ]
5355
}
5456

@@ -62,6 +64,7 @@ fn test_project_skyui_sdk_52() {
6264
mode: .compile
6365
backend: .check
6466
no_cache: true
67+
output_mode: .silent
6568
header_dirs: [ get_source_dir("psc_deps", "Form.psc") ]
6669
}
6770

@@ -75,6 +78,7 @@ fn test_project_mcm_helper() {
7578
mode: .compile
7679
backend: .check
7780
no_cache: true
81+
output_mode: .silent
7882
header_dirs: [
7983
get_source_dir("psc_deps", "Form.psc"),
8084
get_source_dir("SkyuiSDKSources_v5.2", "SKI_ConfigBase.psc")
@@ -91,6 +95,7 @@ fn test_project_lovense_api() {
9195
mode: .compile
9296
backend: .check
9397
no_cache: true
98+
output_mode: .silent
9499
header_dirs: [ get_source_dir("psc_deps", "Form.psc") ]
95100
}
96101

@@ -105,6 +110,7 @@ fn test_project_fnis()
105110
mode: .compile
106111
backend: .check
107112
no_cache: true
113+
output_mode: .silent
108114
header_dirs: [ get_source_dir("psc_deps", "Form.psc") ]
109115
}
110116

@@ -119,6 +125,7 @@ fn test_project_mfgfix()
119125
mode: .compile
120126
backend: .check
121127
no_cache: true
128+
output_mode: .silent
122129
header_dirs: [ get_source_dir("psc_deps", "Form.psc") ]
123130
}
124131

@@ -132,6 +139,7 @@ fn test_project_libfire() {
132139
mode: .compile
133140
backend: .check
134141
no_cache: true
142+
output_mode: .silent
135143
header_dirs: [ get_source_dir("psc_deps", "Form.psc") ]
136144
}
137145

@@ -145,6 +153,7 @@ fn test_project_libturtleclub() {
145153
mode: .compile
146154
backend: .check
147155
no_cache: true
156+
output_mode: .silent
148157
header_dirs: [ get_source_dir("psc_deps", "Form.psc") ]
149158
}
150159

@@ -158,6 +167,7 @@ fn test_project_papyrus_util() {
158167
mode: .compile
159168
backend: .check
160169
no_cache: true
170+
output_mode: .silent
161171
header_dirs: [ get_source_dir("psc_deps", "Form.psc") ]
162172
}
163173

@@ -171,6 +181,7 @@ fn test_project_console_util() {
171181
mode: .compile
172182
backend: .check
173183
no_cache: true
184+
output_mode: .silent
174185
header_dirs: [ get_source_dir("psc_deps", "Form.psc") ]
175186
}
176187

@@ -184,6 +195,7 @@ fn test_project_ni_override() {
184195
mode: .compile
185196
backend: .check
186197
no_cache: true
198+
output_mode: .silent
187199
header_dirs: [ get_source_dir("psc_deps", "Form.psc") ]
188200
}
189201

@@ -197,6 +209,7 @@ fn test_project_race_menu() {
197209
mode: .compile
198210
backend: .check
199211
no_cache: true
212+
output_mode: .silent
200213
header_dirs: [
201214
get_source_dir("psc_deps", "Form.psc"),
202215
get_source_dir("NiOverrideSources", "NiOverride.psc")
@@ -213,6 +226,7 @@ fn test_project_ui_extensions() {
213226
mode: .compile
214227
backend: .check
215228
no_cache: true
229+
output_mode: .silent
216230
header_dirs: [
217231
get_source_dir("psc_deps", "Form.psc"),
218232
get_source_dir("NiOverrideSources", "NiOverride.psc"),
@@ -230,6 +244,7 @@ fn test_project_lib_mathf() {
230244
mode: .compile
231245
backend: .check
232246
no_cache: true
247+
output_mode: .silent
233248
header_dirs: [ get_source_dir("psc_deps", "Form.psc") ]
234249
}
235250

@@ -243,6 +258,7 @@ fn test_project_jcontainers() {
243258
mode: .compile
244259
backend: .check
245260
no_cache: true
261+
output_mode: .silent
246262
header_dirs: [ get_source_dir("psc_deps", "Form.psc") ]
247263
}
248264

@@ -256,6 +272,7 @@ fn test_project_iequip() {
256272
mode: .compile
257273
backend: .check
258274
no_cache: true
275+
output_mode: .silent
259276
header_dirs: [
260277
get_source_dir("psc_deps", "Form.psc"),
261278
get_source_dir("SkyuiSDKSources_v5.2", "SKI_ConfigBase.psc"),
@@ -275,6 +292,7 @@ fn test_project_mantella_spell() {
275292
mode: .compile
276293
backend: .check
277294
no_cache: true
295+
output_mode: .silent
278296
header_dirs: [
279297
get_source_dir("psc_deps", "Form.psc"),
280298
get_source_dir("UIExtensionsSources", "UIExtensions.psc"),
@@ -292,6 +310,7 @@ fn test_project_master_of_disguise() {
292310
mode: .compile
293311
backend: .check
294312
no_cache: true
313+
output_mode: .silent
295314
header_dirs: [
296315
get_source_dir("psc_deps", "Form.psc"),
297316
get_source_dir("LibFireSources", "LibFire.psc"),
@@ -328,6 +347,7 @@ fn test_project_ostim() {
328347
mode: .compile
329348
backend: .check
330349
no_cache: true
350+
output_mode: .silent
331351
header_dirs: [
332352
get_source_dir("psc_deps", "Form.psc"),
333353
get_source_dir("UIExtensionsSources", "UIExtensions.psc"),
@@ -349,6 +369,7 @@ fn test_project_sexlab(){
349369
mode: .compile
350370
backend: .check
351371
no_cache: true
372+
output_mode: .silent
352373
header_dirs: [
353374
get_source_dir("psc_deps", "Form.psc"),
354375
get_source_dir("NiOverrideSources", "NiOverride.psc"),

0 commit comments

Comments
 (0)