Skip to content

Commit 6a5eb3c

Browse files
authored
Merge pull request #34931 from bnbarham/fix-flakey-completion-tests
[SourceKit] Fix flakey completion tests
2 parents 022a9fb + 34ff514 commit 6a5eb3c

6 files changed

+24
-30
lines changed

test/SourceKit/CodeComplete/complete_checkdeps_avoid_check.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ func foo() {
2121
// RUN: %s \
2222
// RUN: )
2323
// RUN: INPUT_DIR=%S/Inputs/checkdeps
24-
// RUN: DEPCHECK_INTERVAL=1
25-
// RUN: SLEEP_TIME=2
2624

2725
// RUN: cp -R $INPUT_DIR/MyProject %t/
2826
// RUN: cp -R $INPUT_DIR/ClangFW.framework %t/Frameworks/
27+
// RUN: touch -t 202001010101 %t/Frameworks/ClangFW.framework/Headers/*
2928
// RUN: %empty-directory(%t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule)
3029
// RUN: %target-swift-frontend -emit-module -module-name SwiftFW -o %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name $INPUT_DIR/SwiftFW_src/Funcs.swift
3130

@@ -36,11 +35,11 @@ func foo() {
3635
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} == \
3736

3837
// RUN: -shell -- echo '### Modify framework (c)' == \
39-
// RUN: -shell -- sleep $SLEEP_TIME == \
4038
// RUN: -shell -- cp -R $INPUT_DIR/ClangFW.framework_mod/* %t/Frameworks/ClangFW.framework/ == \
39+
// RUN: -shell -- touch -t 210001010101 %t/Frameworks/ClangFW.framework/Headers/* == \
4140
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} == \
4241

43-
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=${DEPCHECK_INTERVAL} == \
42+
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=0 == \
4443
// RUN: -shell -- echo '### Checking dependencies' == \
4544
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} \
4645

test/SourceKit/CodeComplete/complete_checkdeps_bridged.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,26 @@ func foo() {
2020
// RUN: %s \
2121
// RUN: )
2222
// RUN: INPUT_DIR=%S/Inputs/checkdeps
23-
// RUN: DEPCHECK_INTERVAL=1
24-
// RUN: SLEEP_TIME=2
2523

2624
// RUN: cp -R $INPUT_DIR/MyProject %t/
2725
// RUN: cp -R $INPUT_DIR/ClangFW.framework %t/Frameworks/
2826
// RUN: %empty-directory(%t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule)
2927
// RUN: %target-swift-frontend -emit-module -module-name SwiftFW -o %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name $INPUT_DIR/SwiftFW_src/Funcs.swift
28+
// RUN: touch -t 202001010101 %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name
3029

3130
// RUN: %sourcekitd-test \
32-
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=${DEPCHECK_INTERVAL} == \
31+
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=0 == \
3332

3433
// RUN: -shell -- echo "### Initial" == \
3534
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} == \
3635

3736
// RUN: -shell -- echo '### Modify bridging header library file' == \
38-
// RUN: -shell -- sleep $SLEEP_TIME == \
3937
// RUN: -shell -- cp -R $INPUT_DIR/MyProject_mod/LocalCFunc.h %t/MyProject/ == \
38+
// RUN: -shell -- touch -t 210001010101 %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name == \
4039
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} == \
4140

4241
// RUN: -shell -- echo '### Fast completion' == \
43-
// RUN: -shell -- sleep $SLEEP_TIME == \
42+
// RUN: -shell -- touch -t 202001010101 %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name == \
4443
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} \
4544

4645
// RUN: | %FileCheck %s

test/SourceKit/CodeComplete/complete_checkdeps_clangmodule.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,26 @@ func foo() {
2020
// RUN: %s \
2121
// RUN: )
2222
// RUN: INPUT_DIR=%S/Inputs/checkdeps
23-
// RUN: DEPCHECK_INTERVAL=1
24-
// RUN: SLEEP_TIME=2
2523

2624
// RUN: cp -R $INPUT_DIR/MyProject %t/
2725
// RUN: cp -R $INPUT_DIR/ClangFW.framework %t/Frameworks/
26+
// RUN: touch -t 202001010101 %t/Frameworks/ClangFW.framework/Headers/*
2827
// RUN: %empty-directory(%t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule)
2928
// RUN: %target-swift-frontend -emit-module -module-name SwiftFW -o %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name $INPUT_DIR/SwiftFW_src/Funcs.swift
3029

3130
// RUN: %sourcekitd-test \
32-
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=${DEPCHECK_INTERVAL} == \
31+
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=0 == \
3332

3433
// RUN: -shell -- echo "### Initial" == \
3534
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} == \
3635

3736
// RUN: -shell -- echo '### Modify framework (c)' == \
38-
// RUN: -shell -- sleep $SLEEP_TIME == \
3937
// RUN: -shell -- cp -R $INPUT_DIR/ClangFW.framework_mod/* %t/Frameworks/ClangFW.framework/ == \
38+
// RUN: -shell -- touch -t 210001010101 %t/Frameworks/ClangFW.framework/Headers/* == \
4039
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} == \
4140

4241
// RUN: -shell -- echo '### Fast completion' == \
43-
// RUN: -shell -- sleep $SLEEP_TIME == \
42+
// RUN: -shell -- touch -t 202001010101 %t/Frameworks/ClangFW.framework/Headers/* == \
4443
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} \
4544

4645
// RUN: | %FileCheck %s

test/SourceKit/CodeComplete/complete_checkdeps_otherfile.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,26 @@ func foo() {
2020
// RUN: %s \
2121
// RUN: )
2222
// RUN: INPUT_DIR=%S/Inputs/checkdeps
23-
// RUN: DEPCHECK_INTERVAL=1
24-
// RUN: SLEEP_TIME=2
2523

2624
// RUN: cp -R $INPUT_DIR/MyProject %t/
25+
// RUN: touch -t 202001010101 %t/MyProject/Library.swift
2726
// RUN: cp -R $INPUT_DIR/ClangFW.framework %t/Frameworks/
2827
// RUN: %empty-directory(%t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule)
2928
// RUN: %target-swift-frontend -emit-module -module-name SwiftFW -o %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name $INPUT_DIR/SwiftFW_src/Funcs.swift
3029

3130
// RUN: %sourcekitd-test \
32-
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=${DEPCHECK_INTERVAL} == \
31+
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=0 == \
3332

3433
// RUN: -shell -- echo "### Initial" == \
3534
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} == \
3635

3736
// RUN: -shell -- echo "### Modify local library file" == \
38-
// RUN: -shell -- sleep $SLEEP_TIME == \
3937
// RUN: -shell -- cp -R $INPUT_DIR/MyProject_mod/Library.swift %t/MyProject/ == \
38+
// RUN: -shell -- touch -t 210001010101 %t/MyProject/Library.swift == \
4039
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} == \
4140

4241
// RUN: -shell -- echo '### Fast completion' == \
43-
// RUN: -shell -- sleep $SLEEP_TIME == \
42+
// RUN: -shell -- touch -t 202001010101 %t/MyProject/Library.swift == \
4443
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} \
4544

4645
// RUN: | %FileCheck %s

test/SourceKit/CodeComplete/complete_checkdeps_ownfile.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,34 @@ func foo(val: MyStruct) {
3535
// RUN: %t/test.swift \
3636
// RUN: )
3737
// RUN: INPUT_DIR=%S/Inputs/checkdeps
38-
// RUN: DEPCHECK_INTERVAL=1
39-
// RUN: SLEEP_TIME=2
4038

4139
// RUN: cp -R $INPUT_DIR/MyProject %t/
4240
// RUN: cp -R $INPUT_DIR/ClangFW.framework %t/Frameworks/
4341
// RUN: %empty-directory(%t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule)
4442
// RUN: %target-swift-frontend -emit-module -module-name SwiftFW -o %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name $INPUT_DIR/SwiftFW_src/Funcs.swift
4543

4644
// RUN: cp %t/State1.swift %t/test.swift
45+
// RUN: touch -t 202001010101 %t/test.swift
4746

4847
// RUN: %sourcekitd-test \
49-
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=${DEPCHECK_INTERVAL} == \
48+
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=0 == \
5049

5150
// RUN: -shell -- echo "### Initial" == \
5251
// RUN: -req=complete -pos=5:4 %t/test.swift -- ${COMPILER_ARGS[@]} == \
5352

54-
// RUN: -shell -- sleep ${SLEEP_TIME} == \
5553
// RUN: -shell -- echo "### Modify own file - 1" == \
5654
// RUN: -shell -- cp %t/State2.swift %t/test.swift == \
55+
// RUN: -shell -- touch -t 210001010101 %t/test.swift == \
5756
// RUN: -req=complete -pos=5:9 %t/test.swift -- ${COMPILER_ARGS[@]} == \
5857

59-
// RUN: -shell -- sleep ${SLEEP_TIME} == \
6058
// RUN: -shell -- echo "### Modify own file - 2" == \
6159
// RUN: -shell -- cp %t/State1.swift %t/test.swift == \
60+
// RUN: -shell -- touch -t 210001010102 %t/test.swift == \
6261
// RUN: -req=complete -pos=5:4 %t/test.swift -- ${COMPILER_ARGS[@]} == \
6362

64-
// RUN: -shell -- sleep ${SLEEP_TIME} == \
6563
// RUN: -shell -- echo "### Modify own file - 3" == \
6664
// RUN: -shell -- cp %t/State2.swift %t/test.swift == \
65+
// RUN: -shell -- touch -t 210001010103 %t/test.swift == \
6766
// RUN: -req=complete -pos=5:9 %t/test.swift -- ${COMPILER_ARGS[@]} \
6867
// RUN: | %FileCheck %s
6968

test/SourceKit/CodeComplete/complete_checkdeps_swiftmodule.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,26 @@ func foo() {
2020
// RUN: %s \
2121
// RUN: )
2222
// RUN: INPUT_DIR=%S/Inputs/checkdeps
23-
// RUN: DEPCHECK_INTERVAL=1
24-
// RUN: SLEEP_TIME=2
2523

2624
// RUN: cp -R $INPUT_DIR/MyProject %t/
2725
// RUN: cp -R $INPUT_DIR/ClangFW.framework %t/Frameworks/
2826
// RUN: %empty-directory(%t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule)
2927
// RUN: %target-swift-frontend -emit-module -module-name SwiftFW -o %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name $INPUT_DIR/SwiftFW_src/Funcs.swift
28+
// RUN: touch -t 202001010101 %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name
3029

3130
// RUN: %sourcekitd-test \
32-
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=${DEPCHECK_INTERVAL} == \
31+
// RUN: -req=global-config -req-opts=completion_check_dependency_interval=0 == \
3332

3433
// RUN: -shell -- echo "### Initial" == \
3534
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} == \
3635

3736
// RUN: -shell -- echo '### Modify framework (s)' == \
38-
// RUN: -shell -- sleep $SLEEP_TIME == \
3937
// RUN: -shell -- %target-swift-frontend -emit-module -module-name SwiftFW -o %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name $INPUT_DIR/SwiftFW_src_mod/Funcs.swift == \
38+
// RUN -shell -- touch -t 210001010101 %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name == \
4039
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} == \
4140

4241
// RUN: -shell -- echo '### Fast completion' == \
43-
// RUN: -shell -- sleep $SLEEP_TIME == \
42+
// RUN: -shell -- touch -t 202001010101 %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name == \
4443
// RUN: -req=complete -pos=5:3 %s -- ${COMPILER_ARGS[@]} \
4544

4645
// RUN: | %FileCheck %s

0 commit comments

Comments
 (0)