Fix aarch64 test (#1007)

This commit is contained in:
Michiel Borkent 2021-09-11 18:13:12 +02:00 committed by GitHub
parent 4c075e07e4
commit 0f723a1e7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 142 additions and 156 deletions

View file

@ -60,6 +60,9 @@ if [ "$BABASHKA_STATIC" = "true" ]; then
args+=("--libc=musl" args+=("--libc=musl"
# see https://github.com/oracle/graal/issues/3398 # see https://github.com/oracle/graal/issues/3398
"-H:CCompilerOption=-Wl,-z,stack-size=2097152") "-H:CCompilerOption=-Wl,-z,stack-size=2097152")
else
# see https://github.com/oracle/graal/issues/3737
args+=("-H:+StaticExecutableWithDynamicLibC")
fi fi
fi fi

View file

@ -9,10 +9,7 @@
(is (instance? java.net.http.WebSocket$Builder (ws-client/websocket-builder)))) (is (instance? java.net.http.WebSocket$Builder (ws-client/websocket-builder))))
(deftest async-smoke-test (deftest async-smoke-test
(when-not (and (is (= 200 (:status @(client/send-async {:uri "https://www.clojure.org" :method :get})))))
(= "aarch64" (System/getenv "BABASHKA_ARCH"))
(= "true" (System/getenv "BABASHKA_STATIC")))
(is (= 200 (:status @(client/send-async {:uri "https://www.clojure.org" :method :get}))))))
(defn ws-handler [{:keys [init] :as opts} req] (defn ws-handler [{:keys [init] :as opts} req]
(when init (init req)) (when init (init req))
@ -28,9 +25,6 @@
(try ~@body (finally (s# :timeout 100))))) (try ~@body (finally (s# :timeout 100)))))
(deftest websockets-smoke-test (deftest websockets-smoke-test
(when-not (and
(= "aarch64" (System/getenv "BABASHKA_ARCH"))
(= "true" (System/getenv "BABASHKA_STATIC")))
(with-ws-server {:on-receive #(httpkit.server/send! %1 %2)} (with-ws-server {:on-receive #(httpkit.server/send! %1 %2)}
(is (= "zomg websockets!" (is (= "zomg websockets!"
(let [p (promise) (let [p (promise)
@ -46,4 +40,4 @@
(ws-client/send "zomg websockets!")) (ws-client/send "zomg websockets!"))
(try (deref p 5000 ::timeout) (try (deref p 5000 ::timeout)
(finally (finally
(ws-client/close ws))))))))) (ws-client/close ws))))))))

View file

@ -239,19 +239,12 @@
"HttpClient$Redirect/NEVER" "HttpClient$Redirect/NEVER"
:always :always
"HttpClient$Redirect/ALWAYS")))] "HttpClient$Redirect/ALWAYS")))]
;; TODO: make graalvm repro of never-ending request with redirect always on linux aarch64 (+ musl?)
(when-not (and (= "aarch64" (System/getenv "BABASHKA_ARCH"))
(= "linux" (System/getenv "BABASHKA_PLATFORM")))
(println "Testing redirect always") (println "Testing redirect always")
(is (= 200 (bb (redirect-prog :always))))) (is (= 200 (bb (redirect-prog :always))))
(println "Testing redirect never") (println "Testing redirect never")
(is (= 302 (bb (redirect-prog :never)))))) (is (= 302 (bb (redirect-prog :never))))))
(deftest ssl-context-test (deftest ssl-context-test
;; TODO: investigate aarch64 issue
(when-not
(and (= "aarch64" (System/getenv "BABASHKA_ARCH"))
(= "linux" (System/getenv "BABASHKA_PLATFORM")))
(is (= {:expired "java.security.cert.CertificateExpiredException" (is (= {:expired "java.security.cert.CertificateExpiredException"
:revoked 200 ;; TODO: fix, "sun.security.cert.CertificateRevokedException" :revoked 200 ;; TODO: fix, "sun.security.cert.CertificateRevokedException"
:self-signed "sun.security.provider.certpath.SunCertPathBuilderException" :self-signed "sun.security.provider.certpath.SunCertPathBuilderException"
@ -336,7 +329,7 @@
(map (fn [[k req]] (map (fn [[k req]]
[k (-> (.send client req handler) [k (-> (.send client req handler)
(.statusCode))])) (.statusCode))]))
(into {}))))))))) (into {}))))))))
;; HttpRequest ;; HttpRequest

View file

@ -43,8 +43,6 @@
(timbre/swap-config! (constantly old-config)))) (timbre/swap-config! (constantly old-config))))
(deftest logging-test (deftest logging-test
(when-not (and (= "true" (System/getenv "BABASHKA_STATIC"))
(= "aarch64" (System/getenv "BABASHKA_ARCH")))
(let [res (tu/bb nil (pr-str program))] (let [res (tu/bb nil (pr-str program))]
(is (= 17 (count (re-seq #"\[dude:.\]" res)))) (is (= 17 (count (re-seq #"\[dude:.\]" res))))
(is (= 6 (count (re-seq #"DEBUG" res)))) (is (= 6 (count (re-seq #"DEBUG" res))))
@ -74,7 +72,7 @@
nil nil
program) program)
res (slurp temp-file)] res (slurp temp-file)]
(is (str/includes? res "hello")))))) (is (str/includes? res "hello")))))
(def readable-prog (def readable-prog
'(do '(do
@ -103,8 +101,6 @@
(timbre/set-level! :debug))) (timbre/set-level! :debug)))
(deftest readable-logging-test (deftest readable-logging-test
(when-not (and (= "true" (System/getenv "BABASHKA_STATIC"))
(= "aarch64" (System/getenv "BABASHKA_ARCH")))
(let [res (tu/bb nil (pr-str readable-prog))] (let [res (tu/bb nil (pr-str readable-prog))]
(testing "spied value is returned and printed (and printed from println even though spyf level isn't enabled)" (testing "spied value is returned and printed (and printed from println even though spyf level isn't enabled)"
(is (= 5 (count (re-seq #"abc,def,ghi" res))))) (is (= 5 (count (re-seq #"abc,def,ghi" res)))))
@ -113,4 +109,4 @@
(testing "strings logged are printed readably" (testing "strings logged are printed readably"
(is (= 3 (count (re-seq #"\"test warn\"" res))))) (is (= 3 (count (re-seq #"\"test warn\"" res)))))
(testing "lists are printed readably" (testing "lists are printed readably"
(is (= 2 (count (re-seq #"\(\\a \\b\)" res)))))))) (is (= 2 (count (re-seq #"\(\\a \\b\)" res)))))))