Skip to content

Commit

Permalink
Add test validating global index store builds (#1070)
Browse files Browse the repository at this point in the history
Previously only arguments were validated, now we validate that the
actions actually succeed, which makes sure we successfully run
index-import
  • Loading branch information
keith authored Jul 7, 2023
1 parent 28a26ad commit 7f04e49
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/features_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ load(
"@build_bazel_rules_swift//test/rules:action_command_line_test.bzl",
"make_action_command_line_test_rule",
)
load(
"@bazel_skylib//rules:build_test.bzl",
"build_test",
)

default_test = make_action_command_line_test_rule()
default_opt_test = make_action_command_line_test_rule(
Expand Down Expand Up @@ -235,3 +239,11 @@ def features_test_suite(name):
target_under_test = "@build_bazel_rules_swift//test/fixtures/linking:cc_bin",
target_compatible_with = ["@platforms//os:macos"],
)

build_test(
name = "{}_global_index_store_builds".format(name),
tags = [name],
targets = [
"//test/fixtures/global_index_store:simple",
],
)
20 changes: 20 additions & 0 deletions test/fixtures/global_index_store/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
load("//swift:swift.bzl", "swift_library")
load("//test/fixtures:common.bzl", "FIXTURE_TAGS")

package(
default_visibility = ["//test:__subpackages__"],
)

swift_library(
name = "simple",
srcs = [
"first.swift",
"second.swift",
],
features = [
"swift.use_global_index_store",
"swift.index_while_building",
],
tags = FIXTURE_TAGS,
target_compatible_with = ["@platforms//os:macos"],
)
4 changes: 4 additions & 0 deletions test/fixtures/global_index_store/first.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
func first() {
print("first")
second()
}
3 changes: 3 additions & 0 deletions test/fixtures/global_index_store/second.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
func second() {
print("second")
}

0 comments on commit 7f04e49

Please sign in to comment.