Skip to content

Commit d9c86fd

Browse files
committed
Fix native image exe path generation
Not naming names, but someone was not testing on Windows with a clean target. Ok. It was me. This also fixes reporting of Windows generated exe file size. Addendum to #165
1 parent ae771d1 commit d9c86fd

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

script/test_native.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
(ns test-native
44
(:require [clojure.java.io :as io]
5+
[helper.env :as env]
56
[helper.fs :as fs]
67
[helper.graal :as graal]
78
[helper.main :as main]
@@ -21,7 +22,7 @@
2122
(let [native-image-xmx "6g"
2223
target-path "target"
2324
target-exe "rewrite-clj-test"
24-
full-target-exe (str (io/file target-path target-exe))]
25+
full-target-exe (str target-path "/" target-exe (when (= :win (env/get-os)) ".exe"))]
2526
(status/line :head "Creating native image for test")
2627
(status/line :detail "java -version")
2728
(shell/command "java -version")

script/test_native_sci.clj

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,19 @@
1818
(shell/command "clojure -M:sci-test:gen-reflection" fname)
1919
(status/line :detail fname))
2020

21-
(defn interpret-tests []
21+
(defn interpret-tests [exe-fname]
2222
(status/line :head "Interpreting tests with sci using natively compiled binary")
23-
(let [exe-fname (if (= :win (env/get-os))
24-
"target/sci-test-rewrite-clj.exe"
25-
"target/sci-test-rewrite-clj")]
26-
(when (not (.exists (io/file exe-fname)))
27-
(status/die 1 "native image %s not found." exe-fname))
28-
(shell/command exe-fname "--file" "script/sci_test_runner.clj" "--classpath" "test")))
23+
(when (not (.exists (io/file exe-fname)))
24+
(status/die 1 "native image %s not found." exe-fname))
25+
(shell/command exe-fname "--file" "script/sci_test_runner.clj" "--classpath" "test"))
2926

3027
(defn -main [& args]
3128
(when (main/doc-arg-opt args)
3229
(let [native-image-xmx "6g"
3330
graal-reflection-fname "target/native-image/reflection.json"
3431
target-path "target"
3532
target-exe "sci-test-rewrite-clj"
36-
full-target-exe (str (io/file target-path target-exe))]
33+
full-target-exe (str target-path "/" target-exe (when (= :win (env/get-os)) ".exe"))]
3734
(status/line :head "Creating native image for testing via sci")
3835
(status/line :detail "java -version")
3936
(shell/command "java -version")
@@ -53,7 +50,7 @@
5350
:entry-class "sci_test.main"})))
5451
(status/line :head "build done")
5552
(status/line :detail "built: %s, %d bytes" full-target-exe (.length (io/file full-target-exe)))
56-
(interpret-tests)))
53+
(interpret-tests full-target-exe)))
5754
nil)
5855

5956
(main/when-invoked-as-script

0 commit comments

Comments
 (0)