tobogganSe connecter

louise

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

62 lignes · 2765 octetsBrut · Historique
1# The cross-language comparison (`tests/compare`), in a container so the
2# language toolchains are pinned (issue #195's report). Louise itself is
3# not built here: the compiler under test is mounted as a bundle (the
4# `louise` binary with its runtime archives next to it, as
5# `target/release/` has them) at `-v .../bundle:/louise:ro`, and the
6# harness uses it via `LOUISE_BIN=/louise/louise`.
7#
8# podman build -t louise-compare -f tests/compare/Containerfile .
9# podman run --rm --cap-add CAP_PERFMON --security-opt seccomp=unconfined \
10# -v "$PWD/target/release:/louise:ro" louise-compare
11#
12# `perf` needs CAP_PERFMON and, under rootless podman, a seccomp profile
13# that allows perf_event_open (the default one does not: the
14# instructions column comes out empty). On an SELinux host add
15# `--security-opt label=disable` (or relabel the mount) so the container
16# may run the mounted compiler. Build with `--platform linux/amd64` on a
17# host that also runs aarch64 images, so the base image is not an
18# aarch64 one left in the cache.
19#
20# (Gleam compiles to JavaScript and runs on node: no Erlang/OTP needed.)
21FROM registry.fedoraproject.org/fedora:44
22
23# The language toolchains, pinned by the distribution. `gcc`/`clang`/`lld`
24# link the Louise programs' C against the mounted runtime archive; `bc`,
25# `gnu-time` and `binutils` (strip) are the harness's.
26RUN dnf install -y \
27 golang ghc \
28 java-latest-openjdk-devel \
29 nodejs python3 \
30 gcc clang lld make \
31 bc /usr/bin/time binutils which findutils diffutils \
32 curl ca-certificates \
33 && dnf clean all
34
35# Rust for the reference `.rs` programs (a later layer: the slow toolchain
36# layer above stays cached). The comparison pins rustc by the distribution.
37# `perf` counts the instructions (see the run's flags above).
38RUN dnf install -y rustc perf && dnf clean all
39
40# Gleam, a release tarball, pinned.
41ARG GLEAM_VERSION=1.19.2
42RUN curl -fsSL \
43 "https://github.com/gleam-lang/gleam/releases/download/v${GLEAM_VERSION}/gleam-v${GLEAM_VERSION}-x86_64-unknown-linux-musl.tar.gz" \
44 -o /tmp/gleam.tgz \
45 && tar -xzf /tmp/gleam.tgz -C /usr/local/bin gleam \
46 && rm /tmp/gleam.tgz \
47 && gleam --version
48
49# The harness and the programs.
50WORKDIR /work
51COPY tests/compare ./tests/compare
52COPY scripts ./scripts
53
54# Warm Gleam's hex cache once (the harness makes a fresh project per
55# program, and each fetches gleam_stdlib from hex.pm otherwise).
56COPY tests/compare/gleam-warm.toml /tmp/warm/gleam.toml
57RUN mkdir -p /tmp/warm/src \
58 && printf 'import gleam/io\npub fn main() { io.println("warm") }\n' > /tmp/warm/src/main.gleam \
59 && (cd /tmp/warm && gleam build --target=javascript --quiet || true)
60
61ENV LOUISE_BIN=/louise/louise
62ENTRYPOINT ["bash", "scripts/compare.sh"]