Skip to content

Commit

Permalink
Remove index fixture (#65)
Browse files Browse the repository at this point in the history
We can generate one of these in the bazel build. Primarily doing this
just in case the format changes since what we care about is the current
version of the code can read the current version of the index store, we
don't care if the old version still works.

Signed-off-by: Keith Smiley <[email protected]>
  • Loading branch information
keith authored Jan 14, 2025
1 parent 230c7d8 commit bedc9d9
Show file tree
Hide file tree
Showing 33 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ let package = Package(
targets: [
.target(name: "CIndexStore"),
.target(name: "IndexStore", dependencies: ["CIndexStore"], linkerSettings: indexLinkerSettings),
.testTarget(name: "IndexStoreTests", dependencies: ["IndexStore"], exclude: ["BUILD", "Data"]),
.testTarget(name: "IndexStoreTests", dependencies: ["IndexStore"], exclude: ["BUILD"]),
.target(
name: "CSwiftDemangle",
cxxSettings: [.headerSearchPath("PrivateHeaders/include")],
Expand Down
20 changes: 16 additions & 4 deletions Tests/IndexStoreTests/BUILD
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_test")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library", "swift_test")

swift_library(
name = "dummy",
testonly = True,
srcs = ["dummy.swift"],
features = ["swift.index_while_building"],
)

filegroup(
name = "dummy-index",
testonly = True,
srcs = [":dummy"],
output_group = "swift_index_store",
)

swift_test(
name = "IndexStoreTests",
srcs = [
"DetermineIndexStorePath.swift",
"IndexStoreTests.swift",
],
data = glob([
"Data/**",
]),
data = [":dummy-index"],
deps = [
"//:IndexStore",
],
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion Tests/IndexStoreTests/DetermineIndexStorePath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
/// - Returns: Index store path for the current test environment
func determineIndexStorePath() -> String {
if let testSrcDir: String = ProcessInfo.processInfo.environment["TEST_SRCDIR"] {
return testSrcDir + "/_main/Tests/IndexStoreTests/Data/main.indexstore"
return testSrcDir + "/_main/Tests/IndexStoreTests/dummy.indexstore"
}
guard let service = ProcessInfo.processInfo.environment["XPC_SERVICE_NAME"] else {
preconditionFailure("Expected XPC_SERVICE_NAME environment variable")
Expand Down
2 changes: 1 addition & 1 deletion Tests/IndexStoreTests/IndexStoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class IndexStoreTests: XCTestCase {
for recordName in unitReader.recordNames {
// Just find one record we know has some reasonable content
guard recordName.hasPrefix("IndexStoreTests.swift") ||
recordName.hasPrefix("main.swift") else {
recordName.hasPrefix("dummy.swift") else {
continue
}

Expand Down
3 changes: 3 additions & 0 deletions Tests/IndexStoreTests/dummy.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
func foo() -> Int {
return 5
}

0 comments on commit bedc9d9

Please sign in to comment.