libphobos: Merge changes in upstream druntime testsuite

libphobos/ChangeLog:

	* libdruntime/MERGE: Merge upstream druntime d2ee11364c.
	* testsuite/libphobos.aa/test_aa.d: Add new test.
	* testsuite/libphobos.betterc/test19933.d: Adjust imports.
	* testsuite/libphobos.config/test22523.d: Likewise.
	* testsuite/libphobos.exceptions/assert_fail.d: Adjust test.
	* testsuite/libphobos.exceptions/chain.d: Adjust imports.
	* testsuite/libphobos.exceptions/future_message.d: Likewise.
	* testsuite/libphobos.exceptions/line_trace.d: Likewise.
	* testsuite/libphobos.exceptions/long_backtrace_trunc.d: Likewise.
	* testsuite/libphobos.exceptions/static_dtor.d: Likewise.
	* testsuite/libphobos.gc/forkgc.d: Likewise.
	* testsuite/libphobos.gc/precisegc.d: Likewise.
	* testsuite/libphobos.gc/recoverfree.d: Likewise.
	* testsuite/libphobos.hash/test_hash.d: Likewise.
	* testsuite/libphobos.init_fini/custom_gc.d: Likewise.
	* testsuite/libphobos.init_fini/thread_join.d: Likewise.
	* testsuite/libphobos.thread/external_threads.d: Likewise.
	* testsuite/libphobos.thread/fiber_guard_page.d: Likewise.
	* testsuite/libphobos.thread/tlsgc_sections.d: Likewise.
	* testsuite/libphobos.thread/tlsstack.d: Likewise.
	* testsuite/libphobos.unittest/customhandler.d: Likewise.
This commit is contained in:
Iain Buclaw 2025-03-15 16:32:48 +01:00
parent f2af60465c
commit b3b54f9c9a
21 changed files with 71 additions and 24 deletions

View file

@ -1,4 +1,4 @@
603225372b211bb66dd0ea1a939043ace5a650cf
d2ee11364c25ca8865eb0acb9596a6147532ef41
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.

View file

@ -40,6 +40,7 @@ void main()
testZeroSizedValue();
testTombstonePurging();
testClear();
testTypeInfoCollect();
}
void testKeysValues1()
@ -585,8 +586,6 @@ void issue13078() nothrow pure
void issue14104()
{
import core.stdc.stdio;
alias K = const(ubyte)*;
size_t[K] aa;
immutable key = cast(K)(cast(size_t) uint.max + 1);
@ -907,3 +906,44 @@ void testClear()
assert(aa.length == 1);
assert(aa[5] == 6);
}
// https://github.com/dlang/dmd/issues/17503
void testTypeInfoCollect()
{
import core.memory;
static struct S
{
int x;
~this() {}
}
static struct AAHolder
{
S[int] aa;
}
static S* getBadS()
{
auto aaholder = new AAHolder;
aaholder.aa[0] = S();
auto s = 0 in aaholder.aa; // keep a pointer to the entry
GC.free(aaholder); // but not a pointer to the AA.
return s;
}
static void stackStomp()
{
import core.stdc.string : memset;
ubyte[4 * 4096] x;
memset(x.ptr, 0, x.sizeof);
}
auto s = getBadS();
stackStomp(); // destroy any stale references to the AA or s except in the current frame;
GC.collect(); // BUG: this used to invalidate the fake type info, should no longer do this.
foreach(i; 0 .. 1000) // try to reallocate the freed type info
auto p = new void*[1];
s = null; // clear any reference to the entry
GC.collect(); // used to segfault.
}

View file

@ -2,7 +2,7 @@
// https://issues.dlang.org/show_bug.cgi?id=19933
// https://issues.dlang.org/show_bug.cgi?id=18816
import core.stdc.stdio;
import core.stdc.stdio : fprintf, stderr;
extern(C) int main()
{

View file

@ -1,6 +1,6 @@
// https://issues.dlang.org/show_bug.cgi?id=22523
import core.stdc.stdio;
import core.stdc.stdio : puts;
int main()
{

View file

@ -523,8 +523,16 @@ void testDestruction()
new long[100];
}
static void clobberStack()
{
ubyte[1024] clobber;
clobber[] = 0xff;
}
import core.memory : GC;
createGarbage();
// ensure there are no stale references on the stack
clobberStack();
GC.collect();
assert(Test.run);

View file

@ -1,7 +1,7 @@
// Author: Ali Çehreli
// See https://forum.dlang.org/post/o2n7f8$2p1t$1@digitalmars.com
import core.stdc.stdio;
import core.stdc.stdio : printf;
class TestException : Exception
{

View file

@ -1,5 +1,5 @@
// { dg-options "-Wno-deprecated" }
import core.stdc.stdio;
import core.stdc.stdio : fprintf, stderr;
// Make sure basic stuff works with future Throwable.message
class NoMessage : Throwable

View file

@ -7,7 +7,7 @@ void main()
}
catch (Exception e)
{
import core.stdc.stdio;
import core.stdc.stdio : printf;
auto str = e.toString();
printf("%.*s\n", cast(int)str.length, str.ptr);
}

View file

@ -30,7 +30,7 @@ void main() {
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH x;
x.tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt(1);
} catch (Exception e) {
import core.stdc.stdio;
import core.stdc.stdio : printf;
auto str = e.toString();
printf("%.*s\n", cast(int)str.length, str.ptr);
}

View file

@ -1,7 +1,7 @@
// { dg-shouldfail "static_dtor_exception" }
// { dg-output "object.Exception@.*: static_dtor_exception" }
// https://issues.dlang.org/show_bug.cgi?id=16594
import core.stdc.stdio;
import core.stdc.stdio : fprintf, stderr;
shared static ~this()
{

View file

@ -1,5 +1,5 @@
import core.memory;
import core.stdc.stdio;
import core.stdc.stdio : printf;
import core.sys.posix.sys.wait;
import core.sys.posix.unistd;

View file

@ -7,7 +7,7 @@
module testgc;
import core.memory;
import core.stdc.stdio;
import core.stdc.stdio : printf;
class C
{

View file

@ -1,5 +1,4 @@
// https://issues.dlang.org/show_bug.cgi?id=20438
import core.stdc.stdio;
import core.memory;
void main()

View file

@ -171,7 +171,7 @@ void issue19568()
~this() @nogc nothrow
{
import core.stdc.stdio;
import core.stdc.stdio : puts;
if (mptr) puts("impure");
}
@ -185,7 +185,7 @@ void issue19568()
~this() @nogc nothrow
{
import core.stdc.stdio;
import core.stdc.stdio : puts;
if (fd != -1) puts("impure");
}

View file

@ -1,6 +1,6 @@
import core.gc.registry;
import core.gc.gcinterface;
import core.stdc.stdlib;
import core.gc.registry;
import core.stdc.stdlib : calloc, malloc, realloc;
static import core.memory;

View file

@ -1,7 +1,6 @@
// Bugzilla 11309 - std.concurrency: OwnerTerminated message doesn't work
// We need to assure that the thread dtors of parent threads run before the thread dtors of the child threads.
import core.thread, core.sync.semaphore;
import core.stdc.stdio;
__gshared Semaphore sem;

View file

@ -1,5 +1,6 @@
import core.sys.posix.pthread;
import core.memory;
import core.sys.posix.pthread : pthread_create, pthread_join;
import core.sys.posix.sys.types : pthread_t;
import core.thread;
extern (C) void rt_moduleTlsCtor();

View file

@ -1,8 +1,8 @@
// { dg-options "-O0" }
// { dg-shouldfail "segv or bus error" }
import core.thread;
import core.sys.posix.signal;
import core.sys.posix.sys.mman;
import core.sys.posix.signal : MINSIGSTKSZ;
import core.sys.posix.sys.mman : MAP_ANON, MAP_PRIVATE, mmap, PROT_READ, PROT_WRITE;
version (LDC) import ldc.attributes;
else struct optStrategy { string a; }

View file

@ -11,7 +11,7 @@ class C
{
~this()
{
import core.stdc.stdlib;
import core.stdc.stdlib : abort;
abort(); // this gets triggered although the instance always stays referenced
}
}

View file

@ -1,6 +1,6 @@
module core.thread.test; // needs access to getStackTop()/getStackBottom()
import core.stdc.stdio;
import core.stdc.stdio : printf;
import core.thread;
ubyte[16384] data;

View file

@ -16,6 +16,6 @@ shared static this()
void main()
{
import core.stdc.stdio;
import core.stdc.stdio : fprintf, stderr;
fprintf(stderr, "main\n");
}