Skip to content

[Frontend/Test] Fix flaky lock_interface test #36285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions test/Driver/lock_interface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
// RUN: echo 'import Foo' > %t/file-01.swift
// RUN: echo 'import Foo' > %t/file-02.swift
// RUN: echo 'import Foo' > %t/file-03.swift
// RUN: %target-swiftc_driver -j20 %t/main.swift %t/file-01.swift %t/file-02.swift %t/file-03.swift -I %t/sdk -Xfrontend -Rmodule-interface-rebuild -module-cache-path %t/module-cache &> %t/result.txt
// RUN: %FileCheck %s -check-prefix=CHECK-REBUILD < %t/result.txt
// RUN: %target-swiftc_driver -j20 %t/main.swift %t/file-01.swift %t/file-02.swift %t/file-03.swift -I %t/sdk -Xfrontend -Rmodule-interface-rebuild -module-cache-path %t/module-cache &> %t/result-with-lock.txt

// RUN: %target-swiftc_driver -j20 %t/main.swift %t/file-01.swift %t/file-02.swift %t/file-03.swift -I %t/sdk -Xfrontend -Rmodule-interface-rebuild -Xfrontend -disable-interface-lock -module-cache-path %t/module-cache-no-lock &> %t/result.txt
/// Checking that the compiler rebuilds the same module more than once can
/// fail depending on how fast the jobs are executed. Just make sure the
/// compiler accepts the -disable-interface-lock flag.
// RUN: %target-swiftc_driver -j20 %t/main.swift %t/file-01.swift %t/file-02.swift %t/file-03.swift -I %t/sdk -Xfrontend -Rmodule-interface-rebuild -Xfrontend -disable-interface-lock -module-cache-path %t/module-cache-no-lock &> %t/result-no-lock.txt

// RUN: %FileCheck %s -check-prefix=CHECK-REBUILD-NO-LOCK < %t/result.txt

// Reset the permissions
/// Reset the permissions before running the tests likely to fail.
// RUN: chmod a+w %t/sdk

// Ensure we only build Foo module once from the interface
// RUN: %FileCheck %s -check-prefix=CHECK-REBUILD < %t/result-with-lock.txt
// CHECK-REBUILD: rebuilding module 'Foo' from interface
// CHECK-REBUILD-NOT: rebuilding module 'Foo' from interface
// CHECK-REBUILD-NOT: building module interface without lock file

// CHECK-REBUILD-NO-LOCK: rebuilding module 'Foo' from interface
// CHECK-REBUILD-NO-LOCK: rebuilding module 'Foo' from interface
// RUN: %FileCheck %s -check-prefix=CHECK-REBUILD-NO-LOCK < %t/result-no-lock.txt
// CHECK-REBUILD-NO-LOCK: rebuilding module 'Foo' from interface