<div dir="ltr">I'm not familiar with LNT, but I've written tests that set environment variables before.<div><br></div><div>Just write your run line as:</div><div><br></div><div>RUN: env FOO=BAR cmd</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Nov 16, 2018 at 1:52 PM Troy Johnson via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is there a better example of an LNTBased test than test-suite/LNTBased/Examples/Simple? It doesn't actually compile or execute anything, so it's not really a useful example, but it does look like a TestModule would allow me to modify the env via Python.<br>
<br>
-Troy<br>
<br>
> -----Original Message-----<br>
> From: llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>> On Behalf Of Troy Johnson<br>
> via llvm-dev<br>
> Sent: Friday, November 16, 2018 1:21 PM<br>
> To: <a href="mailto:chris.matthews@apple.com" target="_blank">chris.matthews@apple.com</a><br>
> Cc: <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> Subject: Re: [llvm-dev] [LNT] How to set an env var before executing a test?<br>
> <br>
> So you're referring to llvm_test_prepare? There aren't many examples of that<br>
> being used. I tried adding a call to it in my test directory's CMakeLists.txt like so:<br>
> <br>
> llvm_test_prepare(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}<br>
> export MY_VAR=42<br>
> )<br>
> <br>
> In the hopes that something would happen, even an error, but it had no effect.<br>
> Nothing at <a href="http://llvm.org/docs/lnt/tests.html" rel="noreferrer" target="_blank">http://llvm.org/docs/lnt/tests.html</a> explains how to use these cmake<br>
> macros, so I'm looking at test-<br>
> suite/External/SPEC/CINT2000/175.vpr/CMakeLists.txt for an example. The<br>
> tests that I have added are under a subdirectory of test-suite/SingleSource, but<br>
> the comment at the top of test-suite/cmake/modules/SingleMultiSource.cmake<br>
> has me worried that nothing new is supposed to go in there. Maybe I should<br>
> move everything under test-suite/External and more closely mimic these SPEC<br>
> CMakeLists.txt?<br>
> <br>
> -Troy<br>
> <br>
> > -----Original Message-----<br>
> > From: <a href="mailto:chris.matthews@apple.com" target="_blank">chris.matthews@apple.com</a> <<a href="mailto:chris.matthews@apple.com" target="_blank">chris.matthews@apple.com</a>><br>
> > Sent: Friday, November 16, 2018 12:26 PM<br>
> > To: Troy Johnson <<a href="mailto:troyj@cray.com" target="_blank">troyj@cray.com</a>><br>
> > Cc: <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> > Subject: Re: [llvm-dev] [LNT] How to set an env var before executing a test?<br>
> ><br>
> > It does not. The prefers way to customize is to use a cmake define.<br>
> ><br>
> > Briefly, LNT is first running cmake, then make to build the tests.<br>
> > Then running Lit to execute them and collect the performance data.<br>
> ><br>
> > I believe via cmake there are ways to change both the test builds and<br>
> execution.<br>
> ><br>
> > > On Nov 16, 2018, at 9:20 AM, Troy Johnson via llvm-dev <llvm-<br>
> > <a href="mailto:dev@lists.llvm.org" target="_blank">dev@lists.llvm.org</a>> wrote:<br>
> > ><br>
> > > Does the LNT test-suite provide a way to have an environment<br>
> > > variable set<br>
> > when executing a test? I can set it outside of LNT (i.e. have it in<br>
> > my environment when LNT is launched) and that works fine, but there<br>
> > does not appear to be a way to set it as part of a test’s<br>
> > configuration. There are some lit.local.cfg files scattered<br>
> > throughout the test-suite repository, but messing with os.environ in<br>
> > those seems to have no effect (and I’m not quite sure what LNT is doing with<br>
> LIT configs anyway).<br>
> > ><br>
> > > -Troy<br>
> > > _______________________________________________<br>
> > > LLVM Developers mailing list<br>
> > > <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> > > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
> <br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>