Commit 6da3008c authored by Mathias LANG's avatar Mathias LANG

community/dmd: Reduce amount of patches

After investigation, it turns out that only one very specific test fails.
So we an safely run the rest of the file to prevent any further regression.
parent 14d9bfaf
Pipeline #67012 passed with stages
in 7 minutes and 57 seconds
From 97936b5b3b236639c7fb8dba13e853d9746475c7 Mon Sep 17 00:00:00 2001
From 3ed41c304dc5f166e5b82a81c1d7f2c2ef9113aa Mon Sep 17 00:00:00 2001
From: Geod24 <pro.mathias.lang@gmail.com>
Date: Tue, 5 Jan 2021 00:16:29 +0900
Date: Wed, 6 Jan 2021 16:04:25 +0900
Subject: Remove failing tests with llvm-libunwind
Those tests fail to retrieve the name of the function,
but at least they don't segv like before, so one might say
we are making progress here.
The GDB tests are problematic on Musl (GDB seems to have issues),
and regarding eh.d, we just disable one failing test,
when multiple exceptions are thrown and -O is used.
---
test/runnable/eh.d | 1042 --------------------------------------
test/runnable/gdb1.d | 16 -
test/runnable/gdb10311.d | 20 -
test/runnable/gdb14225.d | 18 -
test/runnable/gdb14276.d | 22 -
test/runnable/gdb14313.d | 22 -
test/runnable/gdb14330.d | 21 -
test/runnable/gdb4149.d | 24 -
test/runnable/gdb4181.d | 23 -
9 files changed, 1208 deletions(-)
delete mode 100644 test/runnable/eh.d
test/runnable/eh.d | 6 ++++++
test/runnable/gdb1.d | 16 ----------------
test/runnable/gdb10311.d | 20 --------------------
test/runnable/gdb14225.d | 18 ------------------
test/runnable/gdb14276.d | 22 ----------------------
test/runnable/gdb14313.d | 22 ----------------------
test/runnable/gdb14330.d | 21 ---------------------
test/runnable/gdb4149.d | 24 ------------------------
test/runnable/gdb4181.d | 23 -----------------------
9 files changed, 6 insertions(+), 166 deletions(-)
delete mode 100644 test/runnable/gdb1.d
delete mode 100644 test/runnable/gdb10311.d
delete mode 100644 test/runnable/gdb14225.d
......@@ -28,1053 +27,29 @@ we are making progress here.
delete mode 100644 test/runnable/gdb4181.d
diff --git a/test/runnable/eh.d b/test/runnable/eh.d
deleted file mode 100644
index 7e7ec19eb..000000000
index 7e7ec19eb..deb68ae4e 100644
--- a/dmd/test/runnable/eh.d
+++ /dev/null
@@ -1,1042 +0,0 @@
-// PERMUTE_ARGS: -O -fPIC
-
-extern(C) int printf(const char*, ...);
-
-/****************************************************/
-
-class Abc : Exception
-{
- this()
- {
- super("");
- }
- int i;
-}
-
-int y;
-
-alias int boo;
-
-void foo(int x)
-{
- y = cast(boo)1;
-L6:
- try
- {
- printf("try 1\n");
- y += 4;
- if (y == 5)
- goto L6;
- y += 3;
- }
- finally
- {
- y += 5;
- printf("finally 1\n");
- }
- try
- {
- printf("try 2\n");
- y = 1;
- if (y == 4)
- goto L6;
- y++;
- }
- catch (Abc c)
- {
- printf("catch 2\n");
- y = 2 + c.i;
- }
- y++;
- printf("done\n");
-}
-
-/****************************************************/
-
-
-class IntException : Exception
-{
- this(int i)
- {
- m_i = i;
- super("");
- }
-
- int getValue()
- {
- return m_i;
- }
-
- int m_i;
-}
-
-
-void test2()
-{
- int cIterations = 10;
-
- int i;
- long total_x = 0;
- long total_nox = 0;
-
- for(int WARMUPS = 2; WARMUPS-- > 0; )
- {
- for(total_x = 0, i = 0; i < cIterations; ++i)
- {
- total_nox += fn2_nox();
- }
-printf("foo\n");
-
- for(total_nox = 0, i = 0; i < cIterations; ++i)
- {
-printf("i = %d\n", i);
- try
- {
- int z = 1;
-
- throw new IntException(z);
- }
- catch(IntException x)
- {
-printf("catch, i = %d\n", i);
- total_x += x.getValue();
- }
- }
- }
-
- printf("iterations %d totals: %lld, %lld\n", cIterations, total_x, total_nox);
-}
-
-int fn2_nox()
-{
- return 47;
-}
-
-
-/****************************************************/
-
-void test3()
-{
- static int x;
- try
- {
- }
- finally
- {
- printf("a\n");
- assert(x == 0);
- x++;
- }
- printf("--\n");
- assert(x == 1);
- try
- {
- printf("tb\n");
- assert(x == 1);
- }
- finally
- {
- printf("b\n");
- assert(x == 1);
- x++;
- }
- assert(x == 2);
-}
-
-/****************************************************/
-
-class Tester
-{
- this(void delegate() dg_) { dg = dg_; }
- void delegate() dg;
- void stuff() { dg(); }
-}
-
-void test4()
-{
- printf("Starting test\n");
-
- int a = 0;
- int b = 0;
- int c = 0;
- int d = 0;
-
- try
- {
- a++;
- throw new Exception("test1");
- a++;
- }
- catch(Exception e)
- {
- auto es = e.toString();
- printf("%.*s\n", cast(int)es.length, es.ptr);
- b++;
- }
- finally
- {
- c++;
- }
-
- printf("initial test.\n");
-
- assert(a == 1);
- assert(b == 1);
- assert(c == 1);
-
- printf("pass\n");
-
- Tester t = new Tester(
- delegate void()
- {
- try
- {
- a++;
- throw new Exception("test2");
- a++;
- }
- catch(Exception e)
- {
- b++;
- throw e;
- b++;
- }
- });
-
- try
- {
- c++;
- t.stuff();
- c++;
- }
- catch(Exception e)
- {
- d++;
- string es = e.toString;
- printf("%.*s\n", cast(int)es.length, es.ptr);
- }
-
- assert(a == 2);
- assert(b == 2);
- assert(c == 2);
- assert(d == 1);
-
-
- int q0 = 0;
- int q1 = 0;
- int q2 = 0;
- int q3 = 0;
-
- Tester t2 = new Tester(
- delegate void()
- {
- try
- {
- q0++;
- throw new Exception("test3");
- q0++;
- }
- catch(Exception e)
- {
- printf("Never called.\n");
- q1++;
- throw e;
- q1++;
- }
- });
-
- try
- {
- q2++;
- t2.stuff();
- q2++;
- }
- catch(Exception e)
- {
- q3++;
- string es = e.toString;
- printf("%.*s\n", cast(int)es.length, es.ptr);
- }
-
- assert(q0 == 1);
- assert(q1 == 1);
- assert(q2 == 1);
- assert(q3 == 1);
-
- printf("Passed!\n");
-}
-
-/****************************************************/
-
-void test5()
-{
- char[] result;
- int i = 3;
- while(i--)
- {
- try
- {
- printf("i: %d\n", i);
- result ~= 't';
- if (i == 1)
- continue;
- }
- finally
- {
- printf("finally\n");
- result ~= cast(char)('a' + i);
- }
- }
- printf("--- %.*s", cast(int)result.length, result.ptr);
- if (result != "tctbta")
- assert(0);
-}
-
-/****************************************************/
-
-void test6()
-{
- char[] result;
-
- while (true)
- {
- try
- {
- printf("one\n");
- result ~= 'a';
- break;
- }
- finally
- {
- printf("two\n");
- result ~= 'b';
- }
- }
- printf("three\n");
- result ~= 'c';
- if (result != "abc")
- assert(0);
-}
-
-/****************************************************/
-
-string a7;
-
-void doScan(int i)
-{
- a7 ~= "a";
- try
- {
- try
- {
- a7 ~= "b";
- return;
- }
- finally
- {
- a7 ~= "c";
- }
- }
- finally
- {
- a7 ~= "d";
- }
-}
-
-void test7()
-{
- doScan(0);
- assert(a7 == "abcd");
-}
-
-
-/****************************************************
- * Exception chaining tests. See also test4.d
- * Don writes about the complexity:
-
-I can explain this, since I did the original implementation.
-When I originally implemented this, I discovered that the idea of
-"chained exceptions" was hopeless naive. The idea was that while
-processing one exception, if you encounter a second one, and you
-chain them together. Then you get a third, fourth, etc.
-
-The problem is that it's much more complicated than that. Each of
-the exceptions can be a chain of exceptions themselves. This means
-that you don't end up with a chain of exceptions, but rather a tree
-of exceptions. That's why there are those really nasty test cases
-in the test suite.
-
-The examples in the test suite are very difficult to understand if
-you expect it to be a simple chain!
-
-On the one hand, I was very proud that I was able to work out the
-barely-documented behaviour of Windows SEH, and it was really
-thorough. In the initial implementation, all the complexity
-was covered. It wasn't the bugfix-driven-development which dmd
-usually operates under <g>.
-
-But on the other hand, once you can see all of the complexity,
-exception chaining becomes much less convincing as a concept. Sure,
-the full exception tree is available in the final exception which
-you catch. But, is it of any use? I doubt it very much.
-It's pretty clearly a nett loss to the language, it increases
-complexity with negligible benefit. Fortunately in this case, the
-cost isn't really high.
-
-https://digitalmars.com/d/archives/digitalmars/D/Dicebot_on_leaving_D_It_is_anarchy_driven_development_in_all_its_317950.html#N318305
- ****************************************************/
-int result1513;
-
-void bug1513a()
-{
- throw new Exception("d");
-}
-
-void bug1513b()
-{
- try
- {
- try
- {
- bug1513a();
- }
- finally
- {
- result1513 |=4;
- throw new Exception("f");
- }
- }
- catch(Exception e)
- {
- assert(e.msg == "d");
- assert(e.next.msg == "f");
- assert(!e.next.next);
- int i;
- foreach (u; e)
- {
- if (i)
- assert(u.msg == "f");
- else
- assert(u.msg == "d");
- ++i;
- }
- }
-}
-
-void bug1513c()
-{
- try
- {
- try
- {
- throw new Exception("a");
- }
- finally
- {
- result1513 |= 1;
- throw new Exception("b");
- }
- }
- finally
- {
- bug1513b();
- result1513 |= 2;
- throw new Exception("c");
- }
-}
-
-void bug1513()
-{
- result1513 = 0;
- try
- {
- bug1513c();
- }
- catch(Exception e)
- {
- assert(result1513 == 7);
- assert(e.msg == "a");
- assert(e.next.msg == "b");
- assert(e.next.next.msg == "c");
- }
-}
-
-void collideone()
-{
- try
- {
- throw new Exception("x");
- }
- finally
- {
- throw new Exception("y");
- }
-}
-
-void doublecollide()
-{
- try
- {
- try
- {
- try
- {
- throw new Exception("p");
- }
- finally
- {
- throw new Exception("q");
- }
- }
- finally
- {
- collideone();
- }
- }
- catch(Exception e)
- {
- assert(e.msg == "p");
- assert(e.next.msg == "q");
- assert(e.next.next.msg == "x");
- assert(e.next.next.next.msg == "y");
- assert(!e.next.next.next.next);
- }
-}
-
-void collidetwo()
-{
- try
- {
- try
- {
- throw new Exception("p2");
- }
- finally
- {
- throw new Exception("q2");
- }
- }
- finally
- {
- collideone();
- }
-}
-
-void collideMixed()
-{
- int works = 6;
- try
- {
- try
- {
- try
- {
- throw new Exception("e");
- }
- finally
- {
- throw new Error("t");
- }
- }
- catch(Exception f)
- { // Doesn't catch, because Error is chained to it.
- works += 2;
- }
- }
- catch(Error z)
- {
- works += 4;
- assert(z.msg=="t"); // Error comes first
- assert(z.next is null);
- assert(z.bypassedException.msg == "e");
- }
- assert(works == 10);
-}
-
-class AnotherException : Exception
-{
- this(string s)
- {
- super(s);
- }
-}
-
-void multicollide()
-{
- try
- {
- try
- {
- try
- {
- try
- {
- throw new Exception("m2");
- }
- finally
- {
- throw new AnotherException("n2");
- }
- }
- catch(AnotherException s)
- { // Not caught -- we needed to catch the root cause "m2", not
- // just the collateral "n2" (which would leave m2 uncaught).
- assert(0);
- }
- }
- finally
- {
- collidetwo();
- }
- }
- catch(Exception f)
- {
- assert(f.msg == "m2");