diff --git a/.gitignore b/.gitignore index 26bdad1..fc2264c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ test README.html *.import.* deps +tmp diff --git a/Dockerfile b/Dockerfile index 1f03e36..929d157 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/Dockerfile.jenkins b/Dockerfile.jenkins index 344ca27..3fca10c 100644 --- a/Dockerfile.jenkins +++ b/Dockerfile.jenkins @@ -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 diff --git a/Dockerfile.test b/Dockerfile.test index 84a5178..8dec0bc 100644 --- a/Dockerfile.test +++ b/Dockerfile.test @@ -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 diff --git a/Makefile b/Makefile index 4dcd817..fda74b7 100644 --- a/Makefile +++ b/Makefile @@ -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