Fixing tests

This commit is contained in:
retropikzel 2025-07-15 09:27:16 +03:00
parent 0758aa5c84
commit 3f8f06f1e2
5 changed files with 14 additions and 10 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@ test
README.html
*.import.*
deps
tmp

View File

@ -9,3 +9,4 @@ COPY compile-r7rs.scm .
COPY libs/ libs/
RUN make && make install
WORKDIR /workdir
RUN mkdir -p ${HOME}/.snow && echo "()" > ${HOME}/.snow/config.scm

View File

@ -9,3 +9,4 @@ COPY compile-r7rs.scm .
COPY libs/ libs/
RUN make && make install
WORKDIR /workdir
RUN mkdir -p ${HOME}/.snow && echo "()" > ${HOME}/.snow/config.scm

View File

@ -11,3 +11,4 @@ ARG SCHEME=chibi
ENV COMPILE_R7RS=${SCHEME}
RUN git clone https://github.com/ashinn/chibi-scheme.git --depth=1 \
&& cd chibi-scheme && make -j 16 && make -j 16 install
RUN mkdir -p ${HOME}/.snow && echo "()" > ${HOME}/.snow/config.scm

View File

@ -29,35 +29,36 @@ uninstall:
rm -rf ${PREFIX}/lib/compile-r7rs
rm -rf ${PREFIX}/bin/compile-r7rs
test-r6rs: ${R6RSTMP}
test-r6rs:
rm -rf ${R6RSTMP}
mkdir -p ${R6RSTMP}
mkdir -p ${R6RSTMP}/libs
mkdir -p ${R6RSTMP}/libs/foo
printf "(library (foo bar) (export baz) (import (rnrs)) (define baz (lambda () (display \"Test successfull\") (newline))))" > ${R6RSTMP}/libs/foo/bar.sls
printf "(import (rnrs) (foo bar)) (baz)" > ${R6RSTMP}/main.sps
cd ${R6RSTMP} && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./libs -o main main.sps
-cd ${R6RSTMP} && timeout 60 ./main > ${R6RSTMP}/compile-r7rs-test-result.txt 2>&1
-cd ${R6RSTMP} && timeout 60 ./main > compile-r7rs-test-result.txt 2>&1
@grep "Test successfull" ${R6RSTMP}/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat ${R6RSTMP}/compile-r7rs-test-result.txt && exit 1)
test-r6rs-docker:
docker build -f Dockerfile.test --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} .
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c "make && make install && make clean-test SCHEME=${SCHEME} test-r6rs"
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c "make && make install && make SCHEME=${SCHEME} test-r6rs"
test-r7rs:
rm -rf ${R7RSTMP}
mkdir -p ${R7RSTMP}
mkdir -p ${R7RSTMP}/libs
mkdir -p ${R7RSTMP}/libs/foo
echo "(import (scheme base) (foo bar)) (baz)" > ${R7RSTMP}/main.scm
echo "(define baz (lambda () (display \"Test successfull\") (newline)))" > ${R7RSTMP}/libs/foo/bar.scm
echo "(define-library (foo bar) (import (scheme base) (scheme write)) (export baz) (include \"bar.scm\"))" > ${R7RSTMP}/libs/foo/bar.sld
cd ${R7RSTMP} && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./snow -o main main.scm
-cd ${R7RSTMP} && timeout 60 ./main > ${R7RSTMP}/compile-r7rs-test-result.txt 2>&1
cd ${R7RSTMP} && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./libs -o main main.scm
-cd ${R7RSTMP} && ./main > compile-r7rs-test-result.txt 2>&1
@grep "Test successfull" ${R7RSTMP}/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat ${R7RSTMP}/compile-r7rs-test-result.txt && exit 1)
test-r7rs-docker:
docker build -f Dockerfile.test --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} .
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c "make && make install && make clean-test SCHEME=${SCHEME} test-r7rs"
clean-test:
rm -rf test
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c "make && make install && make SCHEME=${SCHEME} test-r7rs"
clean:
find . -name "*.so" -delete
@ -68,7 +69,6 @@ clean:
find . -name "*.meta" -delete
find . -name "*.import.*" -delete
rm -rf dist
rm -rf test
rm -rf deps