Skip to content

Commit 0f695fe

Browse files
committed
native image tests: Add Clojure 1.11 alpha
1 parent 3c01647 commit 0f695fe

File tree

4 files changed

+62
-13
lines changed

4 files changed

+62
-13
lines changed

.github/workflows/native-image-test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ jobs:
1010
os: [ windows-latest, ubuntu-latest, macos-latest ]
1111
graal-java: [ java11 ]
1212
test: [ test-native, test-native-sci ]
13+
clojure-version: [ 1.10, 1.11 ]
1314

14-
name: ${{ matrix.os }},${{ matrix.graal-java }},${{ matrix.test }}
15+
name: ${{ matrix.os }},${{ matrix.graal-java }},${{ matrix.test }},clj ${{matrix.clojure-version}}
1516

1617
steps:
1718
- uses: actions/checkout@v2
@@ -113,5 +114,5 @@ jobs:
113114
shell: cmd
114115
if: matrix.os == 'windows-latest'
115116
- name: Execute ${{ matrix.test }} native test (macos, linux)
116-
run: bb ${{ matrix.test }}
117+
run: bb ${{ matrix.test }} --clojure-version ${{ matrix.clojure-version }}
117118
if: matrix.os != 'windows-latest'

script/test_jvm_sci.clj

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,31 @@
55
[helper.shell :as shell]
66
[lread.status-line :as status]))
77

8+
(def allowed-clojure-versions '("1.10" "1.11"))
9+
10+
(def args-usage "Valid args: [options]
11+
12+
Options:
13+
-v, --clojure-version VERSION Test with Clojure [1.10, 1.11] [default: 1.10]
14+
--help Show this help")
15+
16+
17+
(defn validate-opts [opts]
18+
(when (not (some #{(get opts "--clojure-version")} allowed-clojure-versions))
19+
(status/die 1 args-usage)))
20+
21+
822
(defn -main [& args]
9-
(when (main/doc-arg-opt args)
10-
(status/line :head "Exposing rewrite-clj API to sci")
11-
(shell/command "clojure -M:script -m sci-test-gen-publics")
23+
(when-let [opts (main/doc-arg-opt args-usage args)]
24+
(validate-opts opts)
25+
(let [clojure-version (get opts "--clojure-version")]
26+
27+
(status/line :head "Exposing rewrite-clj API to sci")
28+
(shell/command "clojure -M:script -m sci-test-gen-publics")
1229

13-
(status/line :head "Interpreting tests with sci from using JVM")
14-
(shell/command "clojure -M:sci-test -m sci-test.main --file script/sci_test_runner.clj --classpath test"))
30+
(status/line :head "Interpreting tests with sci from using JVM using Clojure %s" clojure-version)
31+
(shell/command (format "clojure -M:sci-test:%s -m sci-test.main --file script/sci_test_runner.clj --classpath test"
32+
clojure-version))))
1533
nil)
1634

1735
(main/when-invoked-as-script

script/test_native.clj

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,24 @@
1717
"-m" "clj-graal.gen-test-runner"
1818
"--dest-dir" dir "test-by-namespace"))
1919

20+
(def allowed-clojure-versions '("1.10" "1.11"))
21+
22+
(def args-usage "Valid args: [options]
23+
24+
Options:
25+
-v, --clojure-version VERSION Test with Clojure [1.10, 1.11] [default: 1.10]
26+
--help Show this help")
27+
28+
29+
(defn validate-opts [opts]
30+
(when (not (some #{(get opts "--clojure-version")} allowed-clojure-versions))
31+
(status/die 1 args-usage)))
32+
2033
(defn -main [& args]
21-
(when (main/doc-arg-opt args)
22-
(let [native-image-xmx "6g"
34+
(when-let [opts (main/doc-arg-opt args-usage args)]
35+
(validate-opts opts)
36+
(let [clojure-version (get opts "--clojure-version")
37+
native-image-xmx "6g"
2338
target-path "target"
2439
target-exe "rewrite-clj-test"
2540
full-target-exe (str target-path "/" target-exe (when (= :win (env/get-os)) ".exe"))]
@@ -31,7 +46,7 @@
3146
test-runner-dir "target/generated/graal"]
3247
(graal/clean)
3348
(generate-test-runner test-runner-dir)
34-
(let [classpath (graal/compute-classpath "test-common:graal:native-test")]
49+
(let [classpath (graal/compute-classpath (str "test-common:graal:native-test:" clojure-version))]
3550
(graal/aot-compile-sources classpath "clj-graal.test-runner")
3651
(graal/run-native-image {:graal-native-image graal-native-image
3752
:target-path target-path

script/test_native_sci.clj

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,24 @@
2424
(status/die 1 "native image %s not found." exe-fname))
2525
(shell/command exe-fname "--file" "script/sci_test_runner.clj" "--classpath" "test"))
2626

27+
(def allowed-clojure-versions '("1.10" "1.11"))
28+
29+
(def args-usage "Valid args: [options]
30+
31+
Options:
32+
-v, --clojure-version VERSION Test with Clojure [1.10, 1.11] [default: 1.10]
33+
--help Show this help")
34+
35+
36+
(defn validate-opts [opts]
37+
(when (not (some #{(get opts "--clojure-version")} allowed-clojure-versions))
38+
(status/die 1 args-usage)))
39+
2740
(defn -main [& args]
28-
(when (main/doc-arg-opt args)
29-
(let [native-image-xmx "6g"
41+
(when-let [opts (main/doc-arg-opt args-usage args)]
42+
(validate-opts opts)
43+
(let [clojure-version (get opts "--clojure-version")
44+
native-image-xmx "6g"
3045
graal-reflection-fname "target/native-image/reflection.json"
3146
target-path "target"
3247
target-exe "sci-test-rewrite-clj"
@@ -38,7 +53,7 @@
3853
(let [graal-native-image (graal/find-graal-native-image)]
3954
(graal/clean)
4055
(expose-api-to-sci)
41-
(let [classpath (graal/compute-classpath "graal:sci-test")]
56+
(let [classpath (graal/compute-classpath (str "graal:sci-test:" clojure-version))]
4257
(graal/aot-compile-sources classpath "sci-test.main")
4358
(generate-reflection-file graal-reflection-fname)
4459
(graal/run-native-image {:graal-native-image graal-native-image

0 commit comments

Comments
 (0)