@@ -40,7 +40,7 @@ class CachesAutoBuildTest : AbstractNativeSimpleTest() {
40
40
fun testSimple () {
41
41
val rootDir = File (" $TEST_SUITE_PATH /simple" )
42
42
val lib = compileToLibrary(rootDir.resolve(" lib" ), buildDir)
43
- val main = compileToExecutable(rootDir.resolve(" main" ), autoCacheFrom = buildDir, emptyList(), lib)
43
+ val main = compileToExecutable(rootDir.resolve(" main" ), autoCacheFrom = buildDir, emptyList(), emptyList(), lib)
44
44
45
45
assertTrue(main.executableFile.exists())
46
46
assertTrue(autoCacheDir.resolve(cacheFlavor).resolve(" lib" ).exists())
@@ -54,7 +54,7 @@ class CachesAutoBuildTest : AbstractNativeSimpleTest() {
54
54
val userLib = compileToLibrary(rootDir.resolve(" userLib" ), buildDir.resolve(" user" ), externalLib)
55
55
val main = compileToExecutable(
56
56
rootDir.resolve(" main" ),
57
- autoCacheFrom = buildDir.resolve(" external" ), emptyList(),
57
+ autoCacheFrom = buildDir.resolve(" external" ), emptyList(), emptyList(),
58
58
externalLib, userLib
59
59
)
60
60
@@ -73,24 +73,45 @@ class CachesAutoBuildTest : AbstractNativeSimpleTest() {
73
73
compileToStaticCache(lib, cacheDir)
74
74
val makePerFileCache = testRunSettings.get<CacheMode >().makePerFileCaches
75
75
assertTrue(cacheDir.resolve(" lib-${if (makePerFileCache) " per-file-cache" else " cache" } " ).exists())
76
- val main = compileToExecutable(rootDir.resolve(" main" ), autoCacheFrom = buildDir, listOf (cacheDir), lib)
76
+ val main = compileToExecutable(rootDir.resolve(" main" ), autoCacheFrom = buildDir, listOf (cacheDir), emptyList(), lib)
77
77
78
78
assertTrue(main.executableFile.exists())
79
79
assertFalse(autoCacheDir.resolve(cacheFlavor).resolve(" lib" ).exists())
80
80
}
81
81
82
- private fun compileToExecutable (sourcesDir : File , autoCacheFrom : File , cacheDirectories : List <File >, vararg dependencies : KLIB ) =
83
- compileToExecutable(
84
- sourcesDir,
85
- tryPassSystemCacheDirectory = false , // With auto-cache mode, the compiler chooses the system cache directory itself.
86
- freeCompilerArgs = TestCompilerArgs (
87
- listOf (
88
- " -Xauto-cache-from=${autoCacheFrom.absolutePath} " ,
89
- " -Xauto-cache-dir=${autoCacheDir.absolutePath} " ,
90
- ) + cacheDirectories.map { " -Xcache-directory=${it.absolutePath} " }
91
- ),
92
- * dependencies
93
- ).assertSuccess().resultingArtifact
82
+ @Test
83
+ @TestMetadata(" testCustomBinaryOptions" )
84
+ fun testCustomBinaryOptions () {
85
+ val rootDir = File (" $TEST_SUITE_PATH /simple" )
86
+ val lib = compileToLibrary(rootDir.resolve(" lib" ), buildDir)
87
+ val main = compileToExecutable(rootDir.resolve(" main" ), autoCacheFrom = buildDir, emptyList(), emptyList(), lib)
88
+
89
+ assertTrue(main.executableFile.exists())
90
+ assertTrue(autoCacheDir.resolve(cacheFlavor).resolve(" lib" ).exists())
91
+
92
+ val customRuntimeAsserts = " -Xbinary=runtimeAssertionsMode=log"
93
+ val main2 = compileToExecutable(rootDir.resolve(" main" ), autoCacheFrom = buildDir, emptyList(), listOf (customRuntimeAsserts), lib)
94
+
95
+ assertTrue(main2.executableFile.exists())
96
+ }
97
+
98
+ private fun compileToExecutable (
99
+ sourcesDir : File ,
100
+ autoCacheFrom : File ,
101
+ cacheDirectories : List <File >,
102
+ additionalArgs : List <String >,
103
+ vararg dependencies : KLIB
104
+ ) = compileToExecutable(
105
+ sourcesDir,
106
+ tryPassSystemCacheDirectory = false , // With auto-cache mode, the compiler chooses the system cache directory itself.
107
+ freeCompilerArgs = TestCompilerArgs (
108
+ listOf (
109
+ " -Xauto-cache-from=${autoCacheFrom.absolutePath} " ,
110
+ " -Xauto-cache-dir=${autoCacheDir.absolutePath} " ,
111
+ ) + cacheDirectories.map { " -Xcache-directory=${it.absolutePath} " } + additionalArgs
112
+ ),
113
+ * dependencies
114
+ ).assertSuccess().resultingArtifact
94
115
95
116
private val autoCacheDir: File get() = buildDir.resolve(" __auto_cache__" )
96
117
private val cacheFlavor: String
0 commit comments