Skip to content

Commit 382c08e

Browse files
committed
Kotlin: Fix some integrations tests on Windows
1 parent 15d5369 commit 382c08e

File tree

9 files changed

+19
-10
lines changed

9 files changed

+19
-10
lines changed

java/ql/integration-tests/all-platforms/kotlin/enabling/build.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
from create_database_utils import *
44

5-
runSuccessfully(["kotlinc", "KotlinDefault.kt"])
5+
runSuccessfully([get_cmd("kotlinc"), "KotlinDefault.kt"])
66
os.environ['CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN'] = 'true'
7-
runSuccessfully(["kotlinc", "KotlinDisabled.kt"])
7+
runSuccessfully([get_cmd("kotlinc"), "KotlinDisabled.kt"])
88
del(os.environ['CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN'])
99
os.environ['CODEQL_EXTRACTOR_JAVA_AGENT_ENABLE_KOTLIN'] = 'true'
10-
runSuccessfully(["kotlinc", "KotlinEnabled.kt"])
10+
runSuccessfully([get_cmd("kotlinc"), "KotlinEnabled.kt"])
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from create_database_utils import *
22

33
os.mkdir('lib')
4-
runSuccessfully(["kotlinc", "test.kt", "-d", "lib"])
4+
runSuccessfully([get_cmd("kotlinc"), "test.kt", "-d", "lib"])
55
run_codeql_database_create(["kotlinc user.kt -cp lib"], lang="java")

java/ql/integration-tests/all-platforms/kotlin/extractor_crash/code/build.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import os
44
import subprocess
55

6+
from create_database_utils import *
7+
68
os.environ['CODEQL_KOTLIN_INTERNAL_EXCEPTION_WHILE_EXTRACTING_FILE'] = 'B.kt'
79

8-
subprocess.check_call(['kotlinc', 'A.kt', 'B.kt', 'C.kt', ])
10+
subprocess.check_call([get_cmd('kotlinc'), 'A.kt', 'B.kt', 'C.kt', ])
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from create_database_utils import *
22

33
run_codeql_database_create(["gradle build --no-daemon --no-build-cache"], lang="java")
4-
runSuccessfully(["gradle", "clean"])
4+
runSuccessfully([get_cmd("gradle"), "clean"])
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from create_database_utils import *
22

33
run_codeql_database_create(["gradle build --no-daemon --no-build-cache"], lang="java")
4-
runSuccessfully(["gradle", "clean"])
4+
runSuccessfully([get_cmd("gradle"), "clean"])

java/ql/integration-tests/all-platforms/kotlin/kotlin_file_import/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# will certainly reference the jar, not the source or class file.
66

77
os.mkdir('build')
8-
runSuccessfully(["kotlinc"] + glob.glob("libsrc/*.kt") + ["-d", "build"])
8+
runSuccessfully([get_cmd("kotlinc")] + glob.glob("libsrc/*.kt") + ["-d", "build"])
99
runSuccessfully(["jar", "cf", "extlib.jar", "-C", "build", "abcdefghij", "-C", "build", "META-INF"])
1010
run_codeql_database_create(["kotlinc user.kt -cp extlib.jar"], lang="java")
1111

java/ql/integration-tests/all-platforms/kotlin/kotlin_kfunction/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
run_codeql_database_create(
44
["gradle build --no-daemon --no-build-cache --rerun-tasks"], lang="java")
5-
runSuccessfully(["gradle", "clean"])
5+
runSuccessfully([get_cmd("gradle"), "clean"])

java/ql/integration-tests/all-platforms/kotlin/kotlinc_multi/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
from create_database_utils import *
44

5-
runSuccessfully(["kotlinc", "FileA.kt", "FileB.kt"])
5+
runSuccessfully([get_cmd("kotlinc"), "FileA.kt", "FileB.kt"])
66

java/ql/integration-tests/all-platforms/kotlin/trap_compression/test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
from create_database_utils import *
22

33
def check_extension(directory, expected_extension):
4+
if platform.system() == 'Windows':
5+
# It's important that the path is a Unicode path on Windows, so
6+
# that the right system calls get used.
7+
directory = u'' + directory
8+
if not directory.startswith("\\\\?\\"):
9+
directory = "\\\\?\\" + os.path.abspath(directory)
10+
411
if expected_extension == '.trap':
512
# We start TRAP files with a comment
613
expected_start = b'//'

0 commit comments

Comments
 (0)