Skip to content

Commit 32d8efb

Browse files
committed
add tests
1 parent ba8486a commit 32d8efb

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed

src/AutoBuild.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ function Base.show(io::IO, t::BuildTimer)
4343
end
4444
end
4545

46+
const devdir = Ref(Pkg.devdir())
47+
48+
codedir(name) = joinpath(devdir[], "$(name)_jll")
49+
4650
exclude_logs(_, f) = f != "logs"
4751
only_logs(_, f) = f == "logs"
4852

@@ -266,7 +270,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
266270
skip_build = check_flag!(ARGS, "--skip-build")
267271

268272
if deploy_bin || deploy_jll
269-
code_dir = joinpath(Pkg.devdir(), "$(src_name)_jll")
273+
code_dir = codedir(src_name)
270274

271275
# Shove them into `kwargs` so that we are conditionally passing them along
272276
kwargs = (; kwargs..., code_dir = code_dir)
@@ -584,7 +588,7 @@ yggdrasil_head() = get(ENV, "BUILDKITE_COMMIT", "")
584588

585589
function register_jll(name, build_version, dependencies, julia_compat;
586590
deploy_repo="JuliaBinaryWrappers/$(name)_jll.jl",
587-
code_dir=joinpath(Pkg.devdir(), "$(name)_jll"),
591+
code_dir=_code_dir(name),
588592
gh_auth=Wizard.github_auth(;allow_anonymous=false),
589593
gh_username=gh_get_json(DEFAULT_API, "/user"; auth=gh_auth)["login"],
590594
augment_platform_block::String="",
@@ -1195,7 +1199,7 @@ end
11951199
function rebuild_jll_package(name::String, build_version::VersionNumber, sources::Vector,
11961200
platforms::Vector, products::Vector, dependencies::Vector,
11971201
download_dir::String, upload_prefix::String;
1198-
code_dir::String = joinpath(Pkg.devdir(), "$(name)_jll"),
1202+
code_dir::String = codedir(name),
11991203
verbose::Bool = false, from_scratch::Bool = true,
12001204
kwargs...)
12011205
# We're going to recreate "build_output_meta"
@@ -1299,6 +1303,7 @@ function build_jll_package(src_name::String,
12991303
)
13001304
# Make way, for prince artifacti
13011305
mkpath(joinpath(code_dir, "src", "wrappers"))
1306+
@show code_dir
13021307

13031308
# Drop build dependencies
13041309
dependencies = [d for d in dependencies if is_runtime_dependency(d)]
@@ -1733,7 +1738,7 @@ function build_jll_package(src_name::String,
17331738
end
17341739

17351740
function push_jll_package(name, build_version;
1736-
code_dir = joinpath(Pkg.devdir(), "$(name)_jll"),
1741+
code_dir = codedir(name),
17371742
deploy_repo = "JuliaBinaryWrappers/$(name)_jll.jl",
17381743
gh_auth = Wizard.github_auth(;allow_anonymous=false))
17391744
# Next, push up the wrapper code repository

test/building.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
@testset "Local libfoo" begin
2+
mktempdir() do dev_dir
3+
BinaryBuilder.devdir[] = dev_dir # avoid polluting Pkg.devdir()
4+
mktempdir() do build_path
5+
name = "libfoo"
6+
build_output_meta = build_tarballs(
7+
["--verbose", "--deploy=local"], name, v"1.0.0", [DirectorySource(build_tests_dir)],
8+
libfoo_make_script, [platform], libfoo_products, Dependency[];
9+
skip_audit = true,
10+
)
11+
artifacts_toml = TOML.parsefile(joinpath(BinaryBuilder.codedir(name), "Artifacts.toml"))
12+
testdir = joinpath(build_path, "testdir")
13+
mkdir(testdir)
14+
for artifact in artifacts_toml[name]
15+
for dl in artifact["download"]
16+
url = dl["url"]
17+
tarball_path = joinpath(build_path, basename(url))
18+
Downloads.download(url, tarball_path)
19+
unpack(tarball_path, testdir)
20+
end
21+
end
22+
@test isfile(joinpath(Prefix(testdir), "share", "licenses", "libfoo", "LICENSE.md")) # libfoo_make_script
23+
end
24+
end
25+
BinaryBuilder.devdir[] = Pkg.devdir() # restore
26+
end
27+
128
@testset "Building libfoo" begin
229
# Test building with both `make` and `cmake`, using directory and git repository
330
for script in (libfoo_make_script, libfoo_cmake_script, libfoo_meson_script)

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using Pkg
22
using BinaryBuilder, BinaryBuilder.BinaryBuilderBase
33
using BinaryBuilder.BinaryBuilderBase: preferred_runner, platform_dlext, platform_exeext
44
using Base.BinaryPlatforms
5-
using Random, LibGit2, Test, ObjectFile, SHA
5+
using Random, LibGit2, Test, ObjectFile, SHA, Downloads, TOML
66
import Libdl
77

88
# The platform we're running on

0 commit comments

Comments
 (0)