mirror of
https://github.com/github/codeql.git
synced 2026-04-19 22:14:01 +02:00
Swift: add a test case for symlinks
This commit is contained in:
1
swift/integration-tests/posix-only/symlinks/.gitignore
vendored
Normal file
1
swift/integration-tests/posix-only/symlinks/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*/Sources/A.swift
|
||||
@@ -0,0 +1,4 @@
|
||||
| file://:0:0:0:0 | |
|
||||
| main.swift:0:0:0:0 | main.swift |
|
||||
| preserve/Package.swift:0:0:0:0 | preserve/Package.swift |
|
||||
| resolve/Package.swift:0:0:0:0 | resolve/Package.swift |
|
||||
4
swift/integration-tests/posix-only/symlinks/Files.ql
Normal file
4
swift/integration-tests/posix-only/symlinks/Files.ql
Normal file
@@ -0,0 +1,4 @@
|
||||
import swift
|
||||
|
||||
from File f
|
||||
select f
|
||||
6
swift/integration-tests/posix-only/symlinks/main.swift
Normal file
6
swift/integration-tests/posix-only/symlinks/main.swift
Normal file
@@ -0,0 +1,6 @@
|
||||
public struct preserve {
|
||||
public private(set) var text = "Hello, World!"
|
||||
|
||||
public init() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// swift-tools-version: 5.7
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "preserve",
|
||||
products: [
|
||||
.library(
|
||||
name: "preserve",
|
||||
targets: ["preserve"]),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "preserve",
|
||||
path: "Sources"),
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,18 @@
|
||||
// swift-tools-version: 5.7
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "resolve",
|
||||
products: [
|
||||
.library(
|
||||
name: "resolve",
|
||||
targets: ["resolve"]),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "resolve",
|
||||
path: "Sources"),
|
||||
]
|
||||
)
|
||||
20
swift/integration-tests/posix-only/symlinks/test.py
Normal file
20
swift/integration-tests/posix-only/symlinks/test.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from create_database_utils import *
|
||||
import os
|
||||
|
||||
symlinks = ['preserve/Sources/A.swift', 'resolve/Sources/A.swift']
|
||||
|
||||
for s in symlinks:
|
||||
try:
|
||||
os.symlink(os.getcwd() + '/main.swift', s)
|
||||
except:
|
||||
pass
|
||||
|
||||
run_codeql_database_create([
|
||||
'swift package clean --package-path resolve',
|
||||
'swift build --package-path resolve',
|
||||
'swift package clean --package-path preserve',
|
||||
'env CODEQL_PRESERVE_SYMLINKS=true swift build --package-path preserve'
|
||||
], lang='swift', keep_trap=True)
|
||||
|
||||
for s in symlinks:
|
||||
os.unlink(s)
|
||||
Reference in New Issue
Block a user