FYI: environment variables in Lit tests
Petar
Petar
Wed Jan 23 16:53:26 UTC 2019
On Wednesday, 23 January 2019 at 12:06:21 UTC, Johan Engelen
wrote:
> On Wednesday, 23 January 2019 at 11:13:06 UTC, Petar Kirov
> [ZombineDev] wrote:
>> On Thursday, 17 January 2019 at 00:42:23 UTC, Johan Engelen
>> wrote:
>>> Hi all,
>>> I just found out about lit's "env" command, see:
>>> https://wiki.dlang.org/LDC_Lit-based_testsuite#Environment_variables
>>>
>>> -Johan
>>
>> FYI, env is a POSIX thing [1], so I think it works just by
>> virtue of using the system shell.
>
> The cool thing is that Lit recognizes `env` and makes it work
> cross-platform (same as e.g. `rm` and `mkdir`).
>
> -Johan
Yes, I think you're right. Previously I couldn't find information
in the source code, but now I found this part of the
documentation, which is pretty clear:
https://llvm.org/docs/TestingGuide.html#writing-new-regression-tests
> RUN lines are specified in the comments of the test program
> using the keyword RUN followed by a colon, and lastly the
> command (pipeline) to execute. Together, these lines form the
> “script” that lit executes to run the test case. The syntax of
> the RUN lines is similar to a shell’s syntax for pipelines
> including I/O redirection and variable substitution. **However,
> even though these lines may look like a shell script, they are
> not. RUN lines are interpreted by lit.** Consequently, the
> syntax differs from shell in a few ways. You can specify as
> many RUN lines as needed.
Do you know where I can find the relevant lines in the source
code?
More information about the digitalmars-d-ldc
mailing list