Skip to content

Commit c38324d

Browse files
authored
Remove BinaryBuilder and fix tests on nightly (#525)
1 parent 7bd4dc0 commit c38324d

File tree

4 files changed

+35
-86
lines changed

4 files changed

+35
-86
lines changed

.github/workflows/ci.yml

+9
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ jobs:
2828
arch: x86
2929
steps:
3030
- uses: actions/checkout@v4
31+
32+
# gcc-multilib is needed to build 32bit binaries for the bitfield tests
33+
- if: runner.os == 'Linux'
34+
uses: awalsh128/cache-apt-pkgs-action@v1
35+
with:
36+
packages: gcc-multilib
37+
version: 1.0
38+
3139
- uses: julia-actions/setup-julia@latest
3240
with:
3341
version: ${{ matrix.version }}
@@ -39,6 +47,7 @@ jobs:
3947
- uses: codecov/codecov-action@v4
4048
with:
4149
file: lcov.info
50+
4251
docs:
4352
name: Documentation
4453
runs-on: ubuntu-latest

test/Project.toml

-11
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
[deps]
2-
BinaryBuilder = "12aac903-9f7c-5d81-afc2-d9565ea332ae"
32
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
43
CMake_jll = "3f4e10e2-61f2-5801-8945-23b9d642d0e6"
54
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
65
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
76
ReTest = "e0db7c4e-2690-44b9-bad6-7687da720f89"
87
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
9-
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
108
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
11-
p7zip_jll = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
12-
13-
[compat]
14-
# This is the last release that won't error out on Julia >1.7:
15-
# https://github.com/JuliaPackaging/BinaryBuilder.jl/pull/1318
16-
#
17-
# We don't require much of BinaryBuilder so until BB2 comes out this should be
18-
# safe.
19-
BinaryBuilder = "0.5.8"

test/bitfield/build_tarballs.jl

-35
This file was deleted.

test/test_bitfield.jl

+26-40
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import CMake_jll: cmake
2-
using p7zip_jll, Tar
32
using Clang.Generators
43

54
function build_libbitfield_native()
@@ -14,7 +13,7 @@ function build_libbitfield_native()
1413
if Sys.iswindows()
1514
config_cmd = `$config_cmd -A win32`
1615
elseif Sys.islinux()
17-
config_cmd = `$config_cmd -D CMAKE_C_FLAGS=-march=native -D CMAKE_CXX_FLAGS=-march=native`
16+
config_cmd = `$config_cmd -D CMAKE_C_FLAGS='-m32 -march=native'`
1817
end
1918
end
2019
build_cmd = `$(cmake()) --build $build_dir --config Debug`
@@ -30,32 +29,11 @@ function build_libbitfield_native()
3029
return success
3130
end
3231

33-
34-
function build_libbitfield_binarybuilder()
35-
@info "Building libbitfield binary with BinaryBuilder."
36-
success = true
37-
try
38-
cd(@__DIR__) do
39-
run(`$(Base.julia_cmd()) --project bitfield/build_tarballs.jl`)
40-
# from Pkg.download_verify_unpack
41-
# Note that we filter out the extra log file that's generated
42-
tarball_path = only(filter(!contains("-logs.v"), readdir("products")))
43-
dest = "build"
44-
rm(dest; recursive = true)
45-
Tar.extract(`$(p7zip_jll.p7zip()) x products/$tarball_path -so`, dest)
46-
end
47-
catch e
48-
@warn "Building libbitfield with BinaryBuilder failed" exception=(e, catch_backtrace())
49-
success = false
50-
end
51-
return success
52-
end
53-
5432
function build_libbitfield()
5533
success = true
5634
try
5735
# Compile binary
58-
if !build_libbitfield_binarybuilder() && !build_libbitfield_native()
36+
if !build_libbitfield_native()
5937
error("Could not build libbitfield binary")
6038
end
6139

@@ -77,28 +55,36 @@ function build_libbitfield()
7755
m = Base.@invokelatest LibBitField.Mirror(10, 1.5, 1e6, -4, 7, 3)
7856
Base.@invokelatest LibBitField.toBitfield(Ref(m))
7957
catch e
80-
@warn "Building libbitfield failed: $e"
81-
success = false
58+
if haskey(ENV, "CI")
59+
rethrow()
60+
else
61+
@warn "Building libbitfield failed: $e"
62+
success = false
63+
end
8264
end
8365
return success
8466
end
8567

86-
68+
# The actual tests are in this separate function so it's easier to @invokelatest
69+
# all of the new functions.
70+
function test_libbitfield()
71+
bf = Ref(LibBitField.BitField(Int8(10), 1.5, Int32(1e6), Int32(-4), Int32(7), UInt32(3)))
72+
m = Ref(LibBitField.Mirror(10, 1.5, 1e6, -4, 7, 3))
73+
GC.@preserve bf m begin
74+
pbf = Ptr{LibBitField.BitField}(pointer_from_objref(bf))
75+
pm = Ptr{LibBitField.Mirror}(pointer_from_objref(m))
76+
@test LibBitField.toMirror(bf) == m[]
77+
@test LibBitField.toBitfield(m).a == bf[].a
78+
@test LibBitField.toBitfield(m).b == bf[].b
79+
@test LibBitField.toBitfield(m).c == bf[].c
80+
@test LibBitField.toBitfield(m).d == bf[].d
81+
@test LibBitField.toBitfield(m).e == bf[].e
82+
@test LibBitField.toBitfield(m).f == bf[].f
83+
end
84+
end
8785

8886
@testset "Bitfield" begin
8987
if build_libbitfield()
90-
bf = Ref(LibBitField.BitField(Int8(10), 1.5, Int32(1e6), Int32(-4), Int32(7), UInt32(3)))
91-
m = Ref(LibBitField.Mirror(10, 1.5, 1e6, -4, 7, 3))
92-
GC.@preserve bf m begin
93-
pbf = Ptr{LibBitField.BitField}(pointer_from_objref(bf))
94-
pm = Ptr{LibBitField.Mirror}(pointer_from_objref(m))
95-
@test LibBitField.toMirror(bf) == m[]
96-
@test LibBitField.toBitfield(m).a == bf[].a
97-
@test LibBitField.toBitfield(m).b == bf[].b
98-
@test LibBitField.toBitfield(m).c == bf[].c
99-
@test LibBitField.toBitfield(m).d == bf[].d
100-
@test LibBitField.toBitfield(m).e == bf[].e
101-
@test LibBitField.toBitfield(m).f == bf[].f
102-
end
88+
Base.@invokelatest test_libbitfield()
10389
end
10490
end

0 commit comments

Comments
 (0)