From 4e17e802fea15eb957e8de20a33bd816cf1782f3 Mon Sep 17 00:00:00 2001 From: retropikzel Date: Sun, 21 Sep 2025 09:35:35 +0300 Subject: [PATCH] Fixes to test-r7rs --- Dockerfile | 5 ++--- Makefile | 20 +++++++++++++++++--- test-r7rs.scm | 48 ++++++++++++++++++++++++++++-------------------- 3 files changed, 47 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index 77f5df0..f8ebcb0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,10 +20,9 @@ COPY compile-r7rs.scm . COPY test-r7rs.scm . COPY libs libs -RUN make PREFIX=/opt/compile-r7rs build +RUN make PREFIX=/opt/compile-r7rs RUN make PREFIX=/opt/compile-r7rs install -FROM schemers/chibi -RUN apt-get update && apt-get install -y podman-docker make +FROM debian:trixie COPY --from=build /opt/compile-r7rs /opt/compile-r7rs ENV PATH=/opt/compile-r7rs/bin:${PATH} diff --git a/Makefile b/Makefile index 842ef7b..cf1049a 100644 --- a/Makefile +++ b/Makefile @@ -9,9 +9,23 @@ endif STATIC_LIBS=libs.util.a libs.library-util.a libs.data.a libs.srfi-64-util.a -all: build +all: build-static -build: compile-r7rs test-r7rs +build: + echo "#!/bin/sh" > compile-r7rs + echo "chibi-scheme -A ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\"" >> compile-r7rs + echo "#!/bin/sh" > test-r7rs + echo "chibi-scheme -A ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/test-r7rs.scm \"\$$@\"" >> test-r7rs + +build-static: compile-r7rs test-r7rs + +build-docker-images: build-docker-image-debian + +build-docker-image-debian: + docker build . -f Dockerfile --tag=retropikzel1/compile-r7rs + +push-docker-image-debian: + docker push retropikzel1/compile-r7rs libs.util.a: libs/util.sld libs/util.scm csc -R r7rs -X r7rs -static -c -J -unit libs.util -o libs.util.o libs/util.sld @@ -57,7 +71,7 @@ install: cp -r libs ${PREFIX}/lib/compile-r7rs/ cp compile-r7rs.scm ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm install compile-r7rs ${PREFIX}/bin/compile-r7rs - cp compile-r7rs.scm ${PREFIX}/lib/compile-r7rs/test-r7rs.scm + cp test-r7rs.scm ${PREFIX}/lib/compile-r7rs/test-r7rs.scm install test-r7rs ${PREFIX}/bin/test-r7rs uninstall: diff --git a/test-r7rs.scm b/test-r7rs.scm index ede34ed..a5804ce 100644 --- a/test-r7rs.scm +++ b/test-r7rs.scm @@ -29,9 +29,7 @@ (define output-file (if (member "-o" (command-line)) (cadr (member "-o" (command-line))) - (if input-file - "a.out" - #f))) + "a.out")) (define stop-on-error? (if (member "--stop-on-error" (command-line)) #t #f)) @@ -42,6 +40,9 @@ (define use-docker-head? (if (member "--use-docker-head" (command-line)) #t #f)) +(define debug? + (if (member "--debug" (command-line)) #t #f)) + (define schemes (let ((compile-r7rs (get-environment-variable "COMPILE_R7RS"))) (cond @@ -154,18 +155,29 @@ (for-each echo `("FROM debian:trixie AS build" - "RUN apt-get update && apt-get install -y git gcc wget make guile-3.0-dev libcurl4-openssl-dev" + "RUN apt-get update && apt-get install -y git gcc wget make guile-3.0-dev libcurl4-openssl-dev chicken-bin" + "RUN chicken-install r7rs" "WORKDIR /cache" - "RUN git clone https://github.com/ashinn/chibi-scheme.git --depth=1" - "RUN wget https://gitlab.com/-/project/6808260/uploads/819fd1f988c6af5e7df0dfa70aa3d3fe/akku-1.1.0.tar.gz && tar -xf akku-1.1.0.tar.gz" - "RUN mv akku-1.1.0 akku" + "RUN git clone https://github.com/ashinn/chibi-scheme.git --depth=1" "WORKDIR /cache/chibi-scheme" "RUN make" + "RUN make install" + "WORKDIR /cache" + "RUN wget https://gitlab.com/-/project/6808260/uploads/819fd1f988c6af5e7df0dfa70aa3d3fe/akku-1.1.0.tar.gz && tar -xf akku-1.1.0.tar.gz" + "RUN mv akku-1.1.0 akku" "WORKDIR /cache/akku" "RUN ./configure && make" + "WORKDIR /cache" + "RUN snow-chibi install --always-yes --impls=chicken \"(foreign c)\"" + "RUN snow-chibi install --always-yes --impls=chicken \"(retropikzel system)\"" + "RUN snow-chibi install --always-yes --impls=chicken \"(srfi 170)\"" + "RUN git clone https://gitea.scheme.org/Retropikzel/compile-r7rs.git --depth=1" + "WORKDIR /cache/compile-r7rs" + "RUN make" + ,(string-append "FROM schemers/" scheme (cond ((and (string=? scheme "chicken") @@ -174,7 +186,7 @@ (use-docker-head? ":head") (else ""))) ,(string-append - "RUN apt-get update && apt-get install -y make guile-3.0 libcurl4-openssl-dev " apt-pkgs) + "RUN apt-get update && apt-get install -y make guile-3.0 libcurl4-openssl-dev time tree file " apt-pkgs) "RUN mkdir -p ${HOME}/.snow && echo \"()\" > ${HOME}/.snow/config.scm" "COPY --from=build /cache /cache" @@ -189,6 +201,9 @@ "WORKDIR /cache/akku" "RUN make install" + "WORKDIR /cache/compile-r7rs" + "RUN make install" + "WORKDIR /akku" "RUN akku update" @@ -199,8 +214,8 @@ dockerfile-path)) (define (docker-run-cmd tag cmd) - (string-append "docker run -it -v \"${PWD}:/workdir\" --workdir /workdir " - tag " sh -c \"timeout " timeout " " cmd "\"")) + (string-append "docker run -i -v \"${PWD}:/workdir\" --workdir /workdir " + tag " sh -c \"time timeout " timeout " " cmd "\"")) (for-each (lambda (path) (when (not (file-exists? path)) (create-directory path))) @@ -255,7 +270,7 @@ (docker-build-out (string-append ".test-r7rs/tmp/" scheme "-last-docker-build")) (docker-build-cmd - (string-append "docker build" + (string-append "docker build . " " -f " dockerfile-path " --tag=" docker-tag " > " docker-build-out " 2>&1")) @@ -309,18 +324,11 @@ (system (string-append "mv " docker-build-out " " scheme-docker-build-out " > /dev/null 2>&1")) (system (string-append "mv " build-out " " scheme-build-out " > /dev/null 2>&1")) (system (string-append "mv " run-out " " scheme-run-out " > /dev/null 2>&1")) + (when (not (string=? testname "")) (system (string-append "mv " logfile " " scheme-results-out " > /dev/null 2>&1"))) - (echo - (make-row - (list passes - unexpected-passes - failures - expected-failures - skipped - build-exit-code - run-exit-code))) + (echo (make-row (list passes unexpected-passes failures expected-failures skipped build-exit-code run-exit-code))) (when stop-on-error? (when (not (string=? build-exit-code "0"))