Skip to content

Commit

Permalink
Merge pull request #75483 from jckarter/move-only-tsan-test-require-6.0
Browse files Browse the repository at this point in the history
[6.0] Run moveonly checker + TSAN tests in a separate file.
  • Loading branch information
eeckstein authored Jul 26, 2024
2 parents 6906fc2 + 9e2ed75 commit dc55303
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
2 changes: 0 additions & 2 deletions test/SILOptimizer/moveonly_addresschecker.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// RUN: %target-swift-emit-sil -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s -Xllvm -sil-print-final-ossa-module | %FileCheck %s
// RUN: %target-swift-emit-sil -O -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s
// RUN: %target-swift-emit-sil -sanitize=thread -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s -Xllvm -sil-print-final-ossa-module | %FileCheck %s
// RUN: %target-swift-emit-sil -sanitize=thread -O -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s

// This file contains tests that used to crash due to verifier errors. It must
// be separate from moveonly_addresschecker_diagnostics since when we fail on
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// RUN: %target-swift-emit-sil -sil-verify-all -verify -enable-experimental-feature MoveOnlyClasses -enable-experimental-feature MoveOnlyTuples %s
// RUN: %target-swift-emit-sil -sanitize=thread -sil-verify-all -verify -enable-experimental-feature MoveOnlyClasses -enable-experimental-feature MoveOnlyTuples %s

// This test validates that we properly emit errors if we partially invalidate
// through a type with a deinit.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// RUN: %target-swift-emit-sil %s -O -sil-verify-all -verify -enable-experimental-feature MoveOnlyPartialReinitialization -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses
// RUN: %target-swift-emit-sil -sanitize=thread %s -O -sil-verify-all -verify -enable-experimental-feature MoveOnlyPartialReinitialization -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses

//////////////////
// Declarations //
Expand Down
38 changes: 38 additions & 0 deletions test/SILOptimizer/moveonly_addresschecker_tsan.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// RUN: %target-swift-emit-sil -sanitize=thread -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s -Xllvm -sil-print-final-ossa-module | %FileCheck %s
// RUN: %target-swift-emit-sil -sanitize=thread -O -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s
// REQUIRES: OS=macOS

// This file contains tests that used to crash due to verifier errors. It must
// be separate from moveonly_addresschecker_diagnostics since when we fail on
// the diagnostics in that file, we do not actually run the verifier.

struct TestTrivialReturnValue : ~Copyable {
var i: Int = 5

// We used to error on return buffer.
consuming func drain() -> Int {
let buffer = (consume self).i
self = .init(i: 5)
return buffer
}
}


//////////////////////
// MARK: Misc Tests //
//////////////////////

func testAssertLikeUseDifferentBits() {
struct S : ~Copyable {
var s: [Int] = []
var currentPosition = 5

// CHECK-LABEL: sil private @$s23moveonly_addresschecker30testAssertLikeUseDifferentBitsyyF1SL_V6resume2atySi_tF : $@convention(method) (Int, @inout S) -> () {
// CHECK-NOT: destroy_addr
// CHECK: } // end sil function '$s23moveonly_addresschecker30testAssertLikeUseDifferentBitsyyF1SL_V6resume2atySi_tF'
mutating func resume(at index: Int) {
assert(index >= currentPosition)
currentPosition = index
}
}
}

0 comments on commit dc55303

Please sign in to comment.