[llvm-dev] [LNT] How to set an env var before executing a test?

Troy Johnson via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 16 15:34:40 PST 2018


Zachary, the LNT tests don't have a RUN line like the LIT tests do, so I can't do that.  Thanks for the idea though - I'm exploring all options!

-Troy
________________________________
From: Zachary Turner <zturner at google.com>
Sent: Friday, November 16, 2018 4:40:07 PM
To: Troy Johnson
Cc: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] [LNT] How to set an env var before executing a test?

I'm not familiar with LNT, but I've written tests that set environment variables before.

Just write your run line as:

RUN: env FOO=BAR cmd

On Fri, Nov 16, 2018 at 1:52 PM Troy Johnson via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
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.

-Troy

> -----Original Message-----
> From: llvm-dev <llvm-dev-bounces at lists.llvm.org<mailto:llvm-dev-bounces at lists.llvm.org>> On Behalf Of Troy Johnson
> via llvm-dev
> Sent: Friday, November 16, 2018 1:21 PM
> To: chris.matthews at apple.com<mailto:chris.matthews at apple.com>
> Cc: llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
> Subject: Re: [llvm-dev] [LNT] How to set an env var before executing a test?
>
> So you're referring to llvm_test_prepare?  There aren't many examples of that
> being used.  I tried adding a call to it in my test directory's CMakeLists.txt like so:
>
> llvm_test_prepare(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
>   export MY_VAR=42
> )
>
> In the hopes that something would happen, even an error, but it had no effect.
> Nothing at http://llvm.org/docs/lnt/tests.html explains how to use these cmake
> macros, so I'm looking at test-
> suite/External/SPEC/CINT2000/175.vpr/CMakeLists.txt for an example.  The
> tests that I have added are under a subdirectory of test-suite/SingleSource, but
> the comment at the top of test-suite/cmake/modules/SingleMultiSource.cmake
> has me worried that nothing new is supposed to go in there.  Maybe I should
> move everything under test-suite/External and more closely mimic these SPEC
> CMakeLists.txt?
>
> -Troy
>
> > -----Original Message-----
> > From: chris.matthews at apple.com<mailto:chris.matthews at apple.com> <chris.matthews at apple.com<mailto:chris.matthews at apple.com>>
> > Sent: Friday, November 16, 2018 12:26 PM
> > To: Troy Johnson <troyj at cray.com<mailto:troyj at cray.com>>
> > Cc: llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
> > Subject: Re: [llvm-dev] [LNT] How to set an env var before executing a test?
> >
> > It does not. The prefers way to customize is to use a cmake define.
> >
> > Briefly, LNT is first running cmake, then make to build the tests.
> > Then running Lit to execute them and collect the performance data.
> >
> > I believe via cmake there are ways to change both the test builds and
> execution.
> >
> > > On Nov 16, 2018, at 9:20 AM, Troy Johnson via llvm-dev <llvm-
> > dev at lists.llvm.org<mailto:dev at lists.llvm.org>> wrote:
> > >
> > > Does the LNT test-suite provide a way to have an environment
> > > variable set
> > when executing a test?  I can set it outside of LNT (i.e. have it in
> > my environment when LNT is launched) and that works fine, but there
> > does not appear to be a way to set it as part of a test's
> > configuration.  There are some lit.local.cfg files scattered
> > throughout the test-suite repository, but messing with os.environ in
> > those seems to have no effect (and I'm not quite sure what LNT is doing with
> LIT configs anyway).
> > >
> > > -Troy
> > > _______________________________________________
> > > LLVM Developers mailing list
> > > llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
> > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181116/501f1832/attachment-0001.html>


More information about the llvm-dev mailing list