# The cross-language comparison (`tests/compare`), in a container so the # language toolchains are pinned (issue #195's report). Louise itself is # not built here: the compiler under test is mounted as a bundle (the # `louise` binary with its runtime archives next to it, as # `target/release/` has them) at `-v .../bundle:/louise:ro`, and the # harness uses it via `LOUISE_BIN=/louise/louise`. # # podman build -t louise-compare -f tests/compare/Containerfile . # podman run --rm --cap-add CAP_PERFMON --security-opt seccomp=unconfined \ # -v "$PWD/target/release:/louise:ro" louise-compare # # `perf` needs CAP_PERFMON and, under rootless podman, a seccomp profile # that allows perf_event_open (the default one does not: the # instructions column comes out empty). On an SELinux host add # `--security-opt label=disable` (or relabel the mount) so the container # may run the mounted compiler. Build with `--platform linux/amd64` on a # host that also runs aarch64 images, so the base image is not an # aarch64 one left in the cache. # # (Gleam compiles to JavaScript and runs on node: no Erlang/OTP needed.) FROM registry.fedoraproject.org/fedora:44 # The language toolchains, pinned by the distribution. `gcc`/`clang`/`lld` # link the Louise programs' C against the mounted runtime archive; `bc`, # `gnu-time` and `binutils` (strip) are the harness's. RUN dnf install -y \ golang ghc \ java-latest-openjdk-devel \ nodejs python3 \ gcc clang lld make \ bc /usr/bin/time binutils which findutils diffutils \ curl ca-certificates \ && dnf clean all # Rust for the reference `.rs` programs (a later layer: the slow toolchain # layer above stays cached). The comparison pins rustc by the distribution. # `perf` counts the instructions (see the run's flags above). RUN dnf install -y rustc perf && dnf clean all # Gleam, a release tarball, pinned. ARG GLEAM_VERSION=1.19.2 RUN curl -fsSL \ "https://github.com/gleam-lang/gleam/releases/download/v${GLEAM_VERSION}/gleam-v${GLEAM_VERSION}-x86_64-unknown-linux-musl.tar.gz" \ -o /tmp/gleam.tgz \ && tar -xzf /tmp/gleam.tgz -C /usr/local/bin gleam \ && rm /tmp/gleam.tgz \ && gleam --version # The harness and the programs. WORKDIR /work COPY tests/compare ./tests/compare COPY scripts ./scripts # Warm Gleam's hex cache once (the harness makes a fresh project per # program, and each fetches gleam_stdlib from hex.pm otherwise). COPY tests/compare/gleam-warm.toml /tmp/warm/gleam.toml RUN mkdir -p /tmp/warm/src \ && printf 'import gleam/io\npub fn main() { io.println("warm") }\n' > /tmp/warm/src/main.gleam \ && (cd /tmp/warm && gleam build --target=javascript --quiet || true) ENV LOUISE_BIN=/louise/louise ENTRYPOINT ["bash", "scripts/compare.sh"]