From cc98fd4606222ec1d18878d5e8278dc32910076b Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 3 Nov 2017 12:25:46 -0700 Subject: Fix #248 (#249) * Fix up test runner output for compute. We want compute-based tests to produce a `.actual` file when compilation fails, so we can easily diagnose the issue. I thought I'd added this capability previous, but it seemst to not be present any more. * Compute result types for constructor decls Fixes #246 When the parser sees an `init()` declaration, it can't easily know what type is is supposed to return, so it leaves the type as NULL. This was causing some downstream crashes. Rather than special-case every site that cares about the result type of a callable, we will instead ensure that we install an actual result type on an initializer/constructor as part of its semantic checking. This code needs to handle both the case where the initializer is declared inside a type, as well as the case where it is declared inside an `extension`. --- tools/slang-test/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tools/slang-test/main.cpp') diff --git a/tools/slang-test/main.cpp b/tools/slang-test/main.cpp index 0ff6535b8..7cfa981ae 100644 --- a/tools/slang-test/main.cpp +++ b/tools/slang-test/main.cpp @@ -674,6 +674,7 @@ TestResult runSimpleTest(TestInput& input) // Otherwise we compare to the expected output if (actualOutput != expectedOutput) { + maybeDumpOutput(expectedOutput, actualOutput); result = kTestResult_Fail; } @@ -1147,6 +1148,14 @@ TestResult runComputeComparisonImpl(TestInput& input, const char * langOption, S } auto actualOutput = getOutput(spawner); + auto expectedOutput = getExpectedOutput(outputStem); + if (actualOutput != expectedOutput) + { + String actualOutputPath = outputStem + ".actual"; + Slang::File::WriteAllText(actualOutputPath, actualOutput); + + return kTestResult_Fail; + } // check against reference output if (!File::Exists(actualOutputFile)) -- cgit v1.2.3