run lib tests in Windows CI (#933)
* run lib tests in Windows CI - add batch scripts for invoking tests - skip some tests on windows - tweak a couple tests to run on linux and windows * configure git to checkout with Windows line endings on Appveyor
This commit is contained in:
parent
b6e65c08a8
commit
af6f94ef81
6 changed files with 26 additions and 12 deletions
|
|
@ -17,6 +17,7 @@ cache:
|
||||||
- 'graalvm -> appveyor.yml'
|
- 'graalvm -> appveyor.yml'
|
||||||
|
|
||||||
clone_script:
|
clone_script:
|
||||||
|
- cmd: git config --global core.autocrlf true
|
||||||
- ps: >-
|
- ps: >-
|
||||||
if(-not $env:APPVEYOR_PULL_REQUEST_NUMBER) {
|
if(-not $env:APPVEYOR_PULL_REQUEST_NUMBER) {
|
||||||
git clone -q --branch=$env:APPVEYOR_REPO_BRANCH https://github.com/$env:APPVEYOR_REPO_NAME.git $env:APPVEYOR_BUILD_FOLDER
|
git clone -q --branch=$env:APPVEYOR_REPO_BRANCH https://github.com/$env:APPVEYOR_REPO_NAME.git $env:APPVEYOR_BUILD_FOLDER
|
||||||
|
|
@ -71,6 +72,8 @@ build_script:
|
||||||
|
|
||||||
call script/test.bat
|
call script/test.bat
|
||||||
|
|
||||||
|
call script/run_lib_tests.bat
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: babashka-*-windows-amd64.zip
|
- path: babashka-*-windows-amd64.zip
|
||||||
name: babashka
|
name: babashka
|
||||||
|
|
|
||||||
5
script/lib_tests/run_all_libtests.bat
Normal file
5
script/lib_tests/run_all_libtests.bat
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
if "%BABASHKA_TEST_ENV%" EQU "native" (set BB_CMD=.\bb) else (set BB_CMD=lein bb)
|
||||||
|
|
||||||
|
for /f %%i in ('.\bb clojure -A:lib-tests -Spath') do set BABASHKA_CLASSPATH=%%i
|
||||||
|
|
||||||
|
%BB_CMD% -cp "%BABASHKA_CLASSPATH%;test-resources/lib_tests" -f test-resources/lib_tests/babashka/run_all_libtests.clj %*
|
||||||
1
script/run_lib_tests.bat
Normal file
1
script/run_lib_tests.bat
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
call script/lib_tests/run_all_libtests.bat %* || exit /B 1
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
(ns babashka.run-all-libtests
|
(ns babashka.run-all-libtests
|
||||||
(:require [clojure.java.io :as io]
|
(:require [clojure.java.io :as io]
|
||||||
|
[clojure.string :as str]
|
||||||
[clojure.test :as t]))
|
[clojure.test :as t]))
|
||||||
|
|
||||||
(def ns-args (set (map symbol *command-line-args*)))
|
(def ns-args (set (map symbol *command-line-args*)))
|
||||||
|
|
@ -19,6 +20,10 @@
|
||||||
(swap! status (fn [status]
|
(swap! status (fn [status]
|
||||||
(merge-with + status (dissoc m :type))))))))
|
(merge-with + status (dissoc m :type))))))))
|
||||||
|
|
||||||
|
(def windows? (-> (System/getProperty "os.name")
|
||||||
|
(str/lower-case)
|
||||||
|
(str/includes? "win")))
|
||||||
|
|
||||||
;;;; clj-http-lite
|
;;;; clj-http-lite
|
||||||
|
|
||||||
(test-namespaces 'clj-http.lite.client-test)
|
(test-namespaces 'clj-http.lite.client-test)
|
||||||
|
|
@ -38,8 +43,8 @@
|
||||||
(prn (random-uuid))
|
(prn (random-uuid))
|
||||||
|
|
||||||
;;;; babashka.curl
|
;;;; babashka.curl
|
||||||
|
; skip tests on Windows because of the :compressed thing
|
||||||
(test-namespaces 'babashka.curl-test)
|
(when-not windows? (test-namespaces 'babashka.curl-test))
|
||||||
|
|
||||||
;;;; cprop
|
;;;; cprop
|
||||||
|
|
||||||
|
|
@ -114,7 +119,8 @@
|
||||||
|
|
||||||
(require '[babashka.curl :as curl])
|
(require '[babashka.curl :as curl])
|
||||||
(spit "deps_test.clj"
|
(spit "deps_test.clj"
|
||||||
(:body (curl/get "https://raw.githubusercontent.com/borkdude/deps.clj/master/deps.clj")))
|
(:body (curl/get "https://raw.githubusercontent.com/borkdude/deps.clj/master/deps.clj"
|
||||||
|
(if windows? {:compressed false} {}))))
|
||||||
|
|
||||||
(binding [*command-line-args* ["-Sdescribe"]]
|
(binding [*command-line-args* ["-Sdescribe"]]
|
||||||
(load-file "deps_test.clj"))
|
(load-file "deps_test.clj"))
|
||||||
|
|
@ -170,13 +176,13 @@
|
||||||
(test-namespaces 'httpkit.client-test)
|
(test-namespaces 'httpkit.client-test)
|
||||||
|
|
||||||
;;;; babashka.process
|
;;;; babashka.process
|
||||||
|
(when-not windows?
|
||||||
|
;; test built-in babashka.process
|
||||||
|
(test-namespaces 'babashka.process-test)
|
||||||
|
|
||||||
;; test built-in babashka.process
|
;; test babashka.process from source
|
||||||
(test-namespaces 'babashka.process-test)
|
(require '[babashka.process] :reload)
|
||||||
|
(test-namespaces 'babashka.process-test))
|
||||||
;; test babashka.process from source
|
|
||||||
(require '[babashka.process] :reload)
|
|
||||||
(test-namespaces 'babashka.process-test)
|
|
||||||
|
|
||||||
(test-namespaces 'core-match.core-tests)
|
(test-namespaces 'core-match.core-tests)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -413,7 +413,7 @@
|
||||||
(is (= x (json/read-str (with-out-str (json/pprint x)))))))
|
(is (= x (json/read-str (with-out-str (json/pprint x)))))))
|
||||||
|
|
||||||
(deftest pretty-print-nonescaped-unicode
|
(deftest pretty-print-nonescaped-unicode
|
||||||
(is (= "\"\u1234\u4567\"\n"
|
(is (= (str "\"\u1234\u4567\"" (System/lineSeparator))
|
||||||
(with-out-str
|
(with-out-str
|
||||||
(json/pprint "\u1234\u4567" :escape-unicode false)))))
|
(json/pprint "\u1234\u4567" :escape-unicode false)))))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1048,7 +1048,7 @@
|
||||||
;; (is (nil? *custom-resource-path*)))
|
;; (is (nil? *custom-resource-path*)))
|
||||||
|
|
||||||
(deftest custom-resource-path-setting-url
|
(deftest custom-resource-path-setting-url
|
||||||
(p/set-resource-path! (clojure.java.io/resource "templates/inheritance"))
|
(p/set-resource-path! "templates/inheritance")
|
||||||
#_(is (string? *custom-resource-path*))
|
#_(is (string? *custom-resource-path*))
|
||||||
(is (= (fix-line-sep "Hello, World!\n") (render-file "foo.html" {:name "World"})))
|
(is (= (fix-line-sep "Hello, World!\n") (render-file "foo.html" {:name "World"})))
|
||||||
(p/set-resource-path! nil))
|
(p/set-resource-path! nil))
|
||||||
|
|
@ -1257,4 +1257,3 @@
|
||||||
"debug-value"))
|
"debug-value"))
|
||||||
(testing "basic rendering escapes HTML"
|
(testing "basic rendering escapes HTML"
|
||||||
(is (str/includes? (basic-edn->html {:a "<pre>"}) """))))
|
(is (str/includes? (basic-edn->html {:a "<pre>"}) """))))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue