|
1 | | -@testset "eBPF" begin |
2 | | - |
3 | | -include("definitions/bpf.jl") |
| 1 | +@testitem "BPF" setup=[BPF, Helpers] begin |
4 | 2 |
|
5 | 3 | ############################################################################################ |
6 | 4 |
|
7 | 5 | @testset "No-op" begin |
8 | 6 | kernel() = 0 |
9 | 7 |
|
10 | | - output = sprint(io->bpf_code_native(io, kernel, ())) |
| 8 | + output = sprint(io->BPF.code_native(io, kernel, ())) |
11 | 9 | @test occursin("\tr0 = 0\n\texit", output) |
12 | 10 | end |
13 | 11 | @testset "Return argument" begin |
14 | 12 | kernel(x) = x |
15 | 13 |
|
16 | | - output = sprint(io->bpf_code_native(io, kernel, (UInt64,))) |
| 14 | + output = sprint(io->BPF.code_native(io, kernel, (UInt64,))) |
17 | 15 | @test occursin("\tr0 = r1\n\texit", output) |
18 | 16 | end |
19 | 17 | @testset "Addition" begin |
20 | 18 | kernel(x) = x+1 |
21 | 19 |
|
22 | | - output = sprint(io->bpf_code_native(io, kernel, (UInt64,))) |
| 20 | + output = sprint(io->BPF.code_native(io, kernel, (UInt64,))) |
23 | 21 | @test occursin("\tr0 = r1\n\tr0 += 1\n\texit", output) |
24 | 22 | end |
25 | 23 | @testset "Errors" begin |
26 | 24 | kernel(x) = fakefunc(x) |
27 | 25 |
|
28 | | - @test_throws GPUCompiler.InvalidIRError bpf_code_execution(kernel, (UInt64,)) |
| 26 | + @test_throws GPUCompiler.InvalidIRError BPF.code_execution(kernel, (UInt64,)) |
29 | 27 | end |
30 | 28 | @testset "Function Pointers" begin |
31 | 29 | @testset "valid" begin |
32 | 30 | goodcall(x) = Base.llvmcall("%2 = call i64 inttoptr (i64 3 to i64 (i64)*)(i64 %0)\nret i64 %2", Int, Tuple{Int}, x) |
33 | 31 | kernel(x) = goodcall(x) |
34 | 32 |
|
35 | | - output = sprint(io->bpf_code_native(io, kernel, (Int,))) |
| 33 | + output = sprint(io->BPF.code_native(io, kernel, (Int,))) |
36 | 34 | @test occursin("\tcall 3\n\texit", output) |
37 | 35 | end |
38 | 36 | @testset "invalid" begin |
39 | 37 | badcall(x) = Base.llvmcall("%2 = call i64 inttoptr (i64 3000 to i64 (i64)*)(i64 %0)\nret i64 %2", Int, Tuple{Int}, x) |
40 | 38 | kernel(x) = badcall(x) |
41 | 39 |
|
42 | | - @test_throws GPUCompiler.InvalidIRError bpf_code_execution(kernel, (Int,)) |
| 40 | + @test_throws GPUCompiler.InvalidIRError BPF.code_execution(kernel, (Int,)) |
43 | 41 | end |
44 | 42 | end |
45 | 43 |
|
|
0 commit comments