| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
October 29, 2015 writing DMD tests for inline assembly bugs | ||||
|---|---|---|---|---|
| ||||
while working on issue 15235 I've been trying to add some new tests for DMD. The tests I want to write involve checking that certain asm statements throw syntax errors instead of segfaults, but the fact that asmerr() ends compilation unconditionally is proving to be a problem. __traits(compiles, …) doesn't help (as discovered in issue 15257). The only solution I can think of would be to have a separate test for each statement. Anyone got a better idea? | ||||
October 29, 2015 Re: writing DMD tests for inline assembly bugs | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Cauterite | On 10/29/2015 5:44 AM, Cauterite wrote: > while working on issue 15235 I've been trying to add some new tests for DMD. > > The tests I want to write involve checking that certain asm statements throw > syntax errors instead of segfaults, but the fact that asmerr() ends compilation > unconditionally is proving to be a problem. __traits(compiles, …) doesn't help > (as discovered in issue 15257). > > The only solution I can think of would be to have a separate test for each > statement. Anyone got a better idea? The usual technique in the D test suite is to pipe the output to a file, and then diff against what it should be. Yes, you wind up with about one test file per error message. https://github.com/D-Programming-Language/dmd/tree/master/test/fail_compilation | |||
October 30, 2015 Re: writing DMD tests for inline assembly bugs | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 2015-10-29 18:58, Walter Bright wrote: > The usual technique in the D test suite is to pipe the output to a file, > and then diff against what it should be. Yes, you wind up with about one > test file per error message. > > https://github.com/D-Programming-Language/dmd/tree/master/test/fail_compilation An alternative would be to have multiple tests in the same file, but the actual source code for the tests in string literals. Then the testing framework can write temporary files with the content from the string literals and run the actual compilation on those temporary files. I think that will work pretty good as long as the code inside the string literals are fairly short. Another advantage would be that any specific compiler flags that are required for a given test can be passed as a separate argument instead of being inline in the source code as a comment. -- /Jacob Carlborg | |||
October 30, 2015 Re: writing DMD tests for inline assembly bugs | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Cauterite | This *seems* to fix it: https://github.com/D-Programming-Language/dmd/pull/5244 On Thursday, 29 October 2015 at 12:44:51 UTC, Cauterite wrote: > while working on issue 15235 I've been trying to add some new tests for DMD. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply