mirror of
https://github.com/vlang/v.git
synced 2025-09-16 02:49:31 -04:00
tests: fix compilation of the semaphore_wait.v program with latest V
This commit is contained in:
parent
31c01fe956
commit
d25f281b25
@ -294,6 +294,11 @@ fn get_all_commands() []Command {
|
|||||||
rmfile: 'vtmp_unused'
|
rmfile: 'vtmp_unused'
|
||||||
}
|
}
|
||||||
$if linux {
|
$if linux {
|
||||||
|
res << Command{
|
||||||
|
line: '${vexe} -o swait vlib/v/tests/reliability/semaphore_wait.v'
|
||||||
|
okmsg: 'V can compile semaphore_wait.v on Linux with GC on.'
|
||||||
|
rmfile: 'swait'
|
||||||
|
}
|
||||||
res << Command{
|
res << Command{
|
||||||
line: '${vexe} -cc gcc -keepc -freestanding -o bel vlib/os/bare/bare_example_linux.v'
|
line: '${vexe} -cc gcc -keepc -freestanding -o bel vlib/os/bare/bare_example_linux.v'
|
||||||
okmsg: 'V can compile with -freestanding on Linux with GCC.'
|
okmsg: 'V can compile with -freestanding on Linux with GCC.'
|
||||||
|
@ -46,23 +46,23 @@ const log2n = 9
|
|||||||
const n = 1 << log2n
|
const n = 1 << log2n
|
||||||
const n4 = f64(u64(1) << (4 * log2n))
|
const n4 = f64(u64(1) << (4 * log2n))
|
||||||
|
|
||||||
fn waste_mem() {
|
fn waste_mem() ! {
|
||||||
mut objs := PtrPtrObj{
|
mut objs := PtrPtrObj{
|
||||||
nxt: []&PtrObj{len: n}
|
nxt: unsafe { []&PtrObj{len: n} }
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
sz := rand.int_in_range(10, 1000)
|
sz := rand.int_in_range(10, 1000)!
|
||||||
mut new_obj := &PtrObj{
|
mut new_obj := &PtrObj{
|
||||||
nxt: []&DataObj{len: sz}
|
nxt: unsafe { []&DataObj{len: sz} }
|
||||||
}
|
}
|
||||||
sz2 := rand.int_in_range(10, 500000)
|
sz2 := rand.int_in_range(10, 500000)!
|
||||||
new_obj2 := &DataObj{
|
new_obj2 := &DataObj{
|
||||||
data: []f64{len: sz2}
|
data: []f64{len: sz2}
|
||||||
}
|
}
|
||||||
idx2 := rand.int_in_range(0, sz)
|
idx2 := rand.int_in_range(0, sz)!
|
||||||
new_obj.nxt[idx2] = new_obj2
|
new_obj.nxt[idx2] = new_obj2
|
||||||
// non-equally distributed random index
|
// non-equally distributed random index
|
||||||
idx := int(math.sqrt(math.sqrt(rand.f64n(n4))))
|
idx := int(math.sqrt(math.sqrt(rand.f64n(n4)!)))
|
||||||
objs.nxt[idx] = new_obj
|
objs.nxt[idx] = new_obj
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user