[K/N][Tests] Migrate test withSpaces.kt

^KT-61259
This commit is contained in:
Vladimir Sukharev
2024-02-13 10:07:59 +01:00
committed by Space Team
parent 2bb9b936ac
commit 06a89a0061
4 changed files with 52 additions and 37 deletions
@@ -929,29 +929,6 @@ tasks.register("driver_opt", KonanDriverTest) {
flags = ["-opt"]
}
def generateWithSpaceDefFile() {
def buildDirectory = project.layout.buildDirectory.get().asFile
def mapOption = "--Map \"$buildDirectory/cutom map.map\""
if (PlatformInfo.isAppleTarget(project)) {
mapOption = "-map \"$buildDirectory/cutom map.map\""
} else if (PlatformInfo.isWindowsTarget(project)) {
mapOption = "\"-Wl,--Map,$buildDirectory/cutom map.map\""
}
buildDirectory.mkdirs()
def file = new File("${buildDirectory}/withSpaces.def")
file.write """
headers = stdio.h "${projectDir}/interop/basics/custom headers/custom.h"
linkerOpts = $mapOption
---
int customCompare(const char* str1, const char* str2) {
return custom_strcmp(str1, str2);
}
"""
return file.absolutePath
}
// A helper method to create interop artifacts
void createInterop(String name, Closure conf) {
konanArtifacts {
@@ -1102,10 +1079,6 @@ if (PlatformInfo.isAppleTarget(project)) {
}
}
createInterop("withSpaces") {
it.defFile generateWithSpaceDefFile()
}
createInterop("exceptions_throwThroughBridge") {
it.defFile "interop/exceptions/throwThroughBridge.def"
it.extraOpts "-Xcompile-source", "$projectDir/interop/exceptions/throwThroughBridgeInterop.cpp"
@@ -1182,15 +1155,6 @@ interopTest("interop_embedStaticLibraries") {
interop = 'embedStaticLibraries'
}
interopTest("interop_withSpaces") {
interop ='withSpaces'
source = "interop/basics/withSpaces.kt"
doLast {
assert project.layout.buildDirectory.file("cutom map.map").get().asFile.exists()
}
}
dynamicTest("interop_kt43502") {
interop = "kt43502"
source = "interop/kt43502/main.kt"
@@ -1,7 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int custom_strcmp(const char* str1, const char* str2) {
return strcmp(str1, str2);
}
@@ -1,12 +0,0 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
import kotlin.test.*
import kotlinx.cinterop.*
import withSpaces.*
fun main(args: Array<String>) {
customCompare("first", "second")
}