Skip to content

Commit 68e6abf

Browse files
slavapestovDougGregor
authored andcommitted
Try to fix race in getExistentialMetadata() unit tests
(cherry picked from commit a836009)
1 parent 88eac85 commit 68e6abf

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

unittests/runtime/Metadata.cpp

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -443,16 +443,19 @@ TEST(MetadataTest, getExistentialMetadata) {
443443
});
444444

445445
// protocol compositions are order-invariant
446-
const ProtocolDescriptor *protoList4[] = {
447-
&ProtocolA,
448-
&ProtocolB
449-
};
450-
const ProtocolDescriptor *protoList5[] = {
451-
&ProtocolB,
452-
&ProtocolA
453-
};
454446
RaceTest_ExpectEqual<const ExistentialTypeMetadata *>(
455447
[&]() -> const ExistentialTypeMetadata * {
448+
449+
const ProtocolDescriptor *protoList4[] = {
450+
&ProtocolA,
451+
&ProtocolB
452+
};
453+
454+
const ProtocolDescriptor *protoList5[] = {
455+
&ProtocolB,
456+
&ProtocolA
457+
};
458+
456459
auto ab = swift_getExistentialTypeMetadata(ProtocolClassConstraint::Any,
457460
/*superclass=*/nullptr,
458461
2, protoList4);
@@ -514,13 +517,14 @@ TEST(MetadataTest, getExistentialMetadata) {
514517
return noWitnessTable;
515518
});
516519

517-
const ProtocolDescriptor *protoList8[] = {
518-
&ProtocolNoWitnessTable,
519-
&ProtocolA,
520-
&ProtocolB
521-
};
522520
RaceTest_ExpectEqual<const ExistentialTypeMetadata *>(
523521
[&]() -> const ExistentialTypeMetadata * {
522+
const ProtocolDescriptor *protoList8[] = {
523+
&ProtocolNoWitnessTable,
524+
&ProtocolA,
525+
&ProtocolB
526+
};
527+
524528
auto mixedWitnessTable
525529
= swift_getExistentialTypeMetadata(ProtocolClassConstraint::Class,
526530
/*superclass=*/nullptr,
@@ -560,12 +564,13 @@ TEST(MetadataTest, getExistentialMetadata) {
560564
return special;
561565
});
562566

563-
const ProtocolDescriptor *protoList10[] = {
564-
&ProtocolError,
565-
&ProtocolA
566-
};
567567
RaceTest_ExpectEqual<const ExistentialTypeMetadata *>(
568568
[&]() -> const ExistentialTypeMetadata * {
569+
const ProtocolDescriptor *protoList10[] = {
570+
&ProtocolError,
571+
&ProtocolA
572+
};
573+
569574
auto special
570575
= swift_getExistentialTypeMetadata(ProtocolClassConstraint::Any,
571576
/*superclass=*/nullptr,

0 commit comments

Comments
 (0)