Skip to content

Commit d25f281

Browse files
committed
tests: fix compilation of the semaphore_wait.v program with latest V
1 parent 31c01fe commit d25f281

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

cmd/tools/vtest-all.v

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,11 @@ fn get_all_commands() []Command {
294294
rmfile: 'vtmp_unused'
295295
}
296296
$if linux {
297+
res << Command{
298+
line: '${vexe} -o swait vlib/v/tests/reliability/semaphore_wait.v'
299+
okmsg: 'V can compile semaphore_wait.v on Linux with GC on.'
300+
rmfile: 'swait'
301+
}
297302
res << Command{
298303
line: '${vexe} -cc gcc -keepc -freestanding -o bel vlib/os/bare/bare_example_linux.v'
299304
okmsg: 'V can compile with -freestanding on Linux with GCC.'

vlib/v/tests/reliability/semaphore_wait.v

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,23 @@ const log2n = 9
4646
const n = 1 << log2n
4747
const n4 = f64(u64(1) << (4 * log2n))
4848

49-
fn waste_mem() {
49+
fn waste_mem() ! {
5050
mut objs := PtrPtrObj{
51-
nxt: []&PtrObj{len: n}
51+
nxt: unsafe { []&PtrObj{len: n} }
5252
}
5353
for {
54-
sz := rand.int_in_range(10, 1000)
54+
sz := rand.int_in_range(10, 1000)!
5555
mut new_obj := &PtrObj{
56-
nxt: []&DataObj{len: sz}
56+
nxt: unsafe { []&DataObj{len: sz} }
5757
}
58-
sz2 := rand.int_in_range(10, 500000)
58+
sz2 := rand.int_in_range(10, 500000)!
5959
new_obj2 := &DataObj{
6060
data: []f64{len: sz2}
6161
}
62-
idx2 := rand.int_in_range(0, sz)
62+
idx2 := rand.int_in_range(0, sz)!
6363
new_obj.nxt[idx2] = new_obj2
6464
// non-equally distributed random index
65-
idx := int(math.sqrt(math.sqrt(rand.f64n(n4))))
65+
idx := int(math.sqrt(math.sqrt(rand.f64n(n4)!)))
6666
objs.nxt[idx] = new_obj
6767
}
6868
}

0 commit comments

Comments
 (0)