From 8749c97aec8a3a0edd7d2cf45ce98b4cbd96eece Mon Sep 17 00:00:00 2001 From: Schneems Date: Fri, 17 May 2024 12:16:11 -0500 Subject: [PATCH] Fix local compilation https://github.com/heroku/buildpacks-ruby/pull/284/files#r1603946649 --- buildpacks/ruby/tests/integration_test.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/buildpacks/ruby/tests/integration_test.rs b/buildpacks/ruby/tests/integration_test.rs index abb3a814..8a225626 100644 --- a/buildpacks/ruby/tests/integration_test.rs +++ b/buildpacks/ruby/tests/integration_test.rs @@ -80,8 +80,10 @@ fn test_default_app_ubuntu22() { #[test] #[ignore = "integration test"] fn test_default_app_latest_distro() { + let config = amd_arm_builder_config("heroku/builder:24", "tests/fixtures/default_ruby"); + TestRunner::default().build( - BuildConfig::new("heroku/builder:24", "tests/fixtures/default_ruby"), + config, |context| { println!("{}", context.pack_stdout); assert_contains!(context.pack_stdout, "# Heroku Ruby Buildpack"); @@ -279,3 +281,17 @@ fn frac_seconds(seconds: f64) -> Duration { } const TEST_PORT: u16 = 1234; + +// TODO: Once Pack build supports `--platform` and libcnb-test adjusted accordingly, change this +// to allow configuring the target arch independently of the builder name (eg via env var). +fn amd_arm_builder_config(builder_name: &str, app_dir: &str) -> BuildConfig { + let mut builder = BuildConfig::new(builder_name, app_dir); + + match builder_name { + "heroku/builder:24" if cfg!(target_arch = "aarch64") => { + builder.target_triple("aarch64-unknown-linux-musl") + } + _ => builder.target_triple("x86_64-unknown-linux-musl"), + }; + builder +}