parent
f519c35823
commit
90ac55d588
7 changed files with 51 additions and 28 deletions
22
appveyor.yml
22
appveyor.yml
|
|
@ -8,6 +8,7 @@ clone_folder: C:\projects\babashka
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
GRAALVM_HOME: C:\projects\babashka\graalvm\graalvm-ce-java11-21.1.0
|
GRAALVM_HOME: C:\projects\babashka\graalvm\graalvm-ce-java11-21.1.0
|
||||||
|
JAVA_HOME: C:\projects\babashka\graalvm\graalvm-ce-java11-21.1.0
|
||||||
BABASHKA_XMX: "-J-Xmx5g"
|
BABASHKA_XMX: "-J-Xmx5g"
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
|
|
@ -30,24 +31,26 @@ clone_script:
|
||||||
- cmd: git submodule update --init --recursive
|
- cmd: git submodule update --init --recursive
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
|
- cmd: >-
|
||||||
|
powershell -Command "if (Test-Path('graalvm')) { return } else { (New-Object Net.WebClient).DownloadFile('https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.1.0/graalvm-ce-java11-windows-amd64-21.1.0.zip', 'graalvm.zip') }"
|
||||||
|
|
||||||
|
powershell -Command "if (Test-Path('graalvm')) { return } else { Expand-Archive graalvm.zip graalvm }"
|
||||||
|
|
||||||
- cmd: >-
|
- cmd: >-
|
||||||
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein.bat', 'lein.bat')"
|
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein.bat', 'lein.bat')"
|
||||||
|
|
||||||
call lein self-install
|
call lein self-install
|
||||||
|
|
||||||
# set CLJ_KONDO_TEST_ENV=jvm
|
- cmd: >-
|
||||||
|
set BABASHKA_TEST_ENV=jvm
|
||||||
|
|
||||||
# call script/test.bat
|
call script/test.bat
|
||||||
|
|
||||||
# see https://github.com/quarkusio/quarkus/pull/7663
|
# see https://github.com/quarkusio/quarkus/pull/7663
|
||||||
|
|
||||||
- cmd: >-
|
- cmd: >-
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||||
|
|
||||||
powershell -Command "if (Test-Path('graalvm')) { return } else { (New-Object Net.WebClient).DownloadFile('https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.1.0/graalvm-ce-java11-windows-amd64-21.1.0.zip', 'graalvm.zip') }"
|
|
||||||
|
|
||||||
powershell -Command "if (Test-Path('graalvm')) { return } else { Expand-Archive graalvm.zip graalvm }"
|
|
||||||
|
|
||||||
call script/uberjar.bat
|
call script/uberjar.bat
|
||||||
|
|
||||||
call script/compile.bat
|
call script/compile.bat
|
||||||
|
|
@ -62,12 +65,9 @@ build_script:
|
||||||
|
|
||||||
bb release-artifact %zip%
|
bb release-artifact %zip%
|
||||||
|
|
||||||
# - cmd: >-
|
set BABASHKA_TEST_ENV=native
|
||||||
# lein clean
|
|
||||||
|
|
||||||
# set CLJ_KONDO_TEST_ENV=native
|
call script/test.bat
|
||||||
|
|
||||||
# call script/test.bat
|
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: babashka-*-windows-amd64.zip
|
- path: babashka-*-windows-amd64.zip
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
;; :java-source-paths ["sci/reflector/src-java"]
|
;; :java-source-paths ["sci/reflector/src-java"]
|
||||||
:java-source-paths ["src-java"]
|
:java-source-paths ["src-java"]
|
||||||
:resource-paths ["resources" "sci/resources"]
|
:resource-paths ["resources" "sci/resources"]
|
||||||
|
:test-selectors {:windows :windows}
|
||||||
:dependencies [[org.clojure/clojure "1.11.0-alpha1"]
|
:dependencies [[org.clojure/clojure "1.11.0-alpha1"]
|
||||||
[borkdude/edamame "0.0.11"]
|
[borkdude/edamame "0.0.11"]
|
||||||
[borkdude/graal.locking "0.0.2"]
|
[borkdude/graal.locking "0.0.2"]
|
||||||
|
|
|
||||||
11
script/test.bat
Executable file
11
script/test.bat
Executable file
|
|
@ -0,0 +1,11 @@
|
||||||
|
if "%GRAALVM_HOME%"=="" (
|
||||||
|
echo Please set GRAALVM_HOME
|
||||||
|
exit /b
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "BABASHKA_TEST_ENV: %BABASHKA_TEST_ENV%"
|
||||||
|
|
||||||
|
set JAVA_HOME=%GRAALVM_HOME%
|
||||||
|
set PATH=%GRAALVM_HOME%\bin;%PATH%
|
||||||
|
|
||||||
|
call lein do clean, test :windows
|
||||||
|
|
@ -180,7 +180,7 @@
|
||||||
"session" session "id" (new-id!)})
|
"session" session "id" (new-id!)})
|
||||||
(dotimes [_ 3]
|
(dotimes [_ 3]
|
||||||
(let [reply (read-reply in session @id)]
|
(let [reply (read-reply in session @id)]
|
||||||
(is (= "Hello\n" (:out reply)))))))))
|
(is (= "Hello\n" (tu/normalize (:out reply))))))))))
|
||||||
|
|
||||||
(deftest nrepl-server-test
|
(deftest nrepl-server-test
|
||||||
(let [proc-state (atom nil)
|
(let [proc-state (atom nil)
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
(:require
|
(:require
|
||||||
[babashka.impl.pprint :refer [pprint-namespace]]
|
[babashka.impl.pprint :refer [pprint-namespace]]
|
||||||
[babashka.impl.repl :refer [start-repl!]]
|
[babashka.impl.repl :refer [start-repl!]]
|
||||||
|
[babashka.test-utils :as tu]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[clojure.test :as t :refer [deftest is]]
|
[clojure.test :as t :refer [deftest is]]
|
||||||
[sci.core :as sci]
|
[sci.core :as sci]
|
||||||
|
|
@ -20,18 +21,20 @@
|
||||||
:namespaces {'clojure.pprint pprint-namespace}})))
|
:namespaces {'clojure.pprint pprint-namespace}})))
|
||||||
|
|
||||||
(defn assert-repl [expr expected]
|
(defn assert-repl [expr expected]
|
||||||
(is (str/includes? (sci/with-out-str
|
(is (str/includes? (tu/normalize
|
||||||
|
(sci/with-out-str
|
||||||
(sci/with-in-str (str expr "\n:repl/quit")
|
(sci/with-in-str (str expr "\n:repl/quit")
|
||||||
(repl!))) expected)))
|
(repl!)))) expected)))
|
||||||
|
|
||||||
(defn assert-repl-error [expr expected]
|
(defn assert-repl-error [expr expected]
|
||||||
(is (str/includes?
|
(is (str/includes?
|
||||||
|
(tu/normalize
|
||||||
(let [sw (java.io.StringWriter.)]
|
(let [sw (java.io.StringWriter.)]
|
||||||
(sci/binding [sci/out (java.io.StringWriter.)
|
(sci/binding [sci/out (java.io.StringWriter.)
|
||||||
sci/err sw]
|
sci/err sw]
|
||||||
(sci/with-in-str (str expr "\n:repl/quit")
|
(sci/with-in-str (str expr "\n:repl/quit")
|
||||||
(repl!)))
|
(repl!)))
|
||||||
(str sw)) expected)))
|
(str sw))) expected)))
|
||||||
|
|
||||||
(deftest repl-test
|
(deftest repl-test
|
||||||
(assert-repl "1" "1")
|
(assert-repl "1" "1")
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
:eof nil}
|
:eof nil}
|
||||||
(apply test-utils/bb (when (some? input) (str input)) (map str args))))
|
(apply test-utils/bb (when (some? input) (str input)) (map str args))))
|
||||||
|
|
||||||
(deftest parse-opts-test
|
(deftest ^:windows parse-opts-test
|
||||||
(is (= "1667"
|
(is (= "1667"
|
||||||
(:nrepl (main/parse-opts ["--nrepl-server"]))))
|
(:nrepl (main/parse-opts ["--nrepl-server"]))))
|
||||||
(is (= "1666"
|
(is (= "1666"
|
||||||
|
|
@ -132,7 +132,7 @@
|
||||||
(is (not-empty s)))))
|
(is (not-empty s)))))
|
||||||
|
|
||||||
(deftest malformed-command-line-args-test
|
(deftest malformed-command-line-args-test
|
||||||
(is (thrown-with-msg? Exception #"File does not exist: non-existing\n"
|
(is (thrown-with-msg? Exception #"File does not exist: non-existing"
|
||||||
(bb nil "-f" "non-existing"))))
|
(bb nil "-f" "non-existing"))))
|
||||||
|
|
||||||
(deftest ssl-test
|
(deftest ssl-test
|
||||||
|
|
@ -178,10 +178,11 @@
|
||||||
name)))))
|
name)))))
|
||||||
(testing "print source from file on classpath"
|
(testing "print source from file on classpath"
|
||||||
(is (= "(defn foo [x y]\n (+ x y))\n"
|
(is (= "(defn foo [x y]\n (+ x y))\n"
|
||||||
|
(test-utils/normalize
|
||||||
(bb nil
|
(bb nil
|
||||||
"-cp" dir
|
"-cp" dir
|
||||||
"-e" (format "(require '[clojure.repl :refer [source]] '[%s])" name)
|
"-e" (format "(require '[clojure.repl :refer [source]] '[%s])" name)
|
||||||
"-e" (format "(with-out-str (source %s/foo))" name)))))))
|
"-e" (format "(with-out-str (source %s/foo))" name))))))))
|
||||||
|
|
||||||
(deftest eval-test
|
(deftest eval-test
|
||||||
(is (= "120\n" (test-utils/bb nil "(eval '(do (defn foo [x y] (+ x y))
|
(is (= "120\n" (test-utils/bb nil "(eval '(do (defn foo [x y] (+ x y))
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,19 @@
|
||||||
[babashka.main :as main]
|
[babashka.main :as main]
|
||||||
[babashka.process :as p]
|
[babashka.process :as p]
|
||||||
[clojure.edn :as edn]
|
[clojure.edn :as edn]
|
||||||
|
[clojure.string :as str]
|
||||||
[clojure.test :as test :refer [*report-counters*]]
|
[clojure.test :as test :refer [*report-counters*]]
|
||||||
[sci.core :as sci]
|
[sci.core :as sci]
|
||||||
[sci.impl.vars :as vars]))
|
[sci.impl.vars :as vars]))
|
||||||
|
|
||||||
(set! *warn-on-reflection* true)
|
(set! *warn-on-reflection* true)
|
||||||
|
|
||||||
|
|
||||||
|
(defn normalize [s]
|
||||||
|
(if main/windows?
|
||||||
|
(str/replace s "\r\n" "\n")
|
||||||
|
s))
|
||||||
|
|
||||||
(def ^:dynamic *bb-edn-path* nil)
|
(def ^:dynamic *bb-edn-path* nil)
|
||||||
|
|
||||||
(defmethod clojure.test/report :begin-test-var [m]
|
(defmethod clojure.test/report :begin-test-var [m]
|
||||||
|
|
@ -55,7 +62,7 @@
|
||||||
(with-in-str input-or-opts (apply main/main args))
|
(with-in-str input-or-opts (apply main/main args))
|
||||||
(apply main/main args)))]
|
(apply main/main args)))]
|
||||||
(if (zero? res)
|
(if (zero? res)
|
||||||
(str os)
|
(normalize (str os))
|
||||||
(do
|
(do
|
||||||
(println (str os))
|
(println (str os))
|
||||||
(throw (ex-info (str es)
|
(throw (ex-info (str es)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue