Skip to content
Permalink
Browse files

Check for compilation success, and lib folder

If script/bootstrap hasn't been run, then running script/test returns
the slightly cryptic error message:

  Error: Could not find or load main class clojure.main

This patch checks if the lib folder exists and has files in it. If not
it prompts the user to run script/bootstrap and exits.

This patch also adds a check for CLJS compilation success before running
tests against the various VM engines.
  • Loading branch information
danielcompton authored and swannodette committed Jun 16, 2017
1 parent e475e1d commit 89628498bb20212186f77d87d6a9618031392783
Showing with 21 additions and 4 deletions.
  1. +5 −0 bin/cljsc
  2. +4 −1 script/test
  3. +4 −1 script/test-self-host
  4. +4 −1 script/test-self-parity
  5. +4 −1 script/test-simple
@@ -7,6 +7,11 @@ if [ "$CLOJURESCRIPT_HOME" = "" ]; then
CLOJURESCRIPT_HOME="`dirname $0`/.."
fi

if ! test "$(ls -A "$CLOJURESCRIPT_HOME/lib" 2>/dev/null)"; then
>&2 echo lib/ folder is empty, have you run \`script/bootstrap\`?
exit 1
fi

CLJSC_CP=''
for next in lib/*: src/main/clojure: src/main/cljs: src/test/cljs; do
CLJSC_CP="${CLJSC_CP}${CLOJURESCRIPT_HOME}/${next}"
@@ -8,7 +8,10 @@ mkdir -p builds/out-adv
possible=4
ran=0

bin/cljsc src/test/cljs "{:optimizations :advanced :output-wrapper true :verbose true :compiler-stats true :parallel-build true :output-dir \"builds/out-adv\"}" > builds/out-adv/core-advanced-test.js
if ! bin/cljsc src/test/cljs "{:optimizations :advanced :output-wrapper true :verbose true :compiler-stats true :parallel-build true :output-dir \"builds/out-adv\"}" > builds/out-adv/core-advanced-test.js; then
>&2 echo ClojureScript compilation failed
exit 1
fi;

if [ "$V8_HOME" = "" ]; then
echo "V8_HOME not set, skipping V8 tests"
@@ -4,7 +4,10 @@
rm -rf builds/out-self
mkdir -p builds/out-self

bin/cljsc src/test/self/self_host "{:optimizations :simple :static-fns true :output-dir \"builds/out-self\" :optimize-constants true :verbose true :compiler-stats true :parallel-build true :target :nodejs}" > builds/out-self/core-self-test.js
if ! bin/cljsc src/test/self/self_host "{:optimizations :simple :static-fns true :output-dir \"builds/out-self\" :optimize-constants true :verbose true :compiler-stats true :parallel-build true :target :nodejs}" > builds/out-self/core-self-test.js; then
>&2 echo ClojureScript compilation failed
exit 1
fi;

echo "Testing with Node"
node builds/out-self/core-self-test.js
@@ -15,7 +15,10 @@ mkdir -p builds/out-self-parity/clojure/test
mv clojure/template.clj builds/out-self-parity/clojure
mv clojure/test builds/out-self-parity/clojure

bin/cljsc src/test/self/self_parity "{:optimizations :none :output-to \"builds/out-self-parity/main.js\" :output-dir \"builds/out-self-parity\" :main self-parity.test :target :nodejs}"
if ! bin/cljsc src/test/self/self_parity "{:optimizations :none :output-to \"builds/out-self-parity/main.js\" :output-dir \"builds/out-self-parity\" :main self-parity.test :target :nodejs}"; then
>&2 echo ClojureScript compilation failed
exit 1
fi;

echo "Testing with Node"
node builds/out-self-parity/main.js
@@ -8,7 +8,10 @@ possible=4
ran=0

#bin/cljsc test >out/core-test.js
bin/cljsc src/test/cljs "{:optimizations :simple :static-fns true :output-dir \"builds/out-simp\" :cache-analysis true :output-wrapper true :compiler-stats true}" > builds/out-simp/core-simple-test.js
if ! bin/cljsc src/test/cljs "{:optimizations :simple :static-fns true :output-dir \"builds/out-simp\" :cache-analysis true :output-wrapper true :compiler-stats true}" > builds/out-simp/core-simple-test.js; then
>&2 echo ClojureScript compilation failed
exit 1
fi;

if [ "$V8_HOME" = "" ]; then
echo "V8_HOME not set, skipping V8 tests"

0 comments on commit 8962849

Please sign in to comment.
You can’t perform that action at this time.