Re: Testing source code program with 0install

Thomas Leonard <[email protected]>
Newsgroups gmane.comp.file-systems.zero-install.devel
Message-ID <CAG4opy93Gn9+yKCByt-LLeQoqmL4A3Av=fx45tg6+2HbbaF35A@mail.gmail.com>
On 1 September 2015 at 21:51, Ilja Honkonen <[email protected]> wrote:
> Hello
>
> I have a program, for example:
> int main() {}
> , that I'd like to test by compiling it using several compilers and
> compiler flags. Can I use 0install to automatically compile and run the
> program using all permutations of e.g. "CC = gcc4 gcc5 clang35 clang36
> icc14 icc15" and "CFLAGS = -Os -O0 -O1 -O2 -O3"? The program would also
> have dependencies that I'd like to be compiled with same CC as the program.

It would be nice to support this, but I think there's some work
involved. You'd need to:

- Ensure that 0compile writes to a temporary directory, rather than
caching the results (currently, after compiling with gcc4, it would
assume the resulting binary was still valid when you asked to compile
with gcc5). Setting $XDG_DATA_HOME and $XDG_CONFIG_HOME to point at
temporary directories should do that.

- Provide a way to request different compilers (gcc vs clang), not
just different versions.

- Provide a way to make "0compile autocompile" use the selected
compiler for dependencies too. Creating a directory with the desired
version marked as preferred and setting XDG_CONFIG_HOME to that might
work, except that it would ignore your setting if it created a
conflict (e.g. something only worked with gcc 4), so you might need to
mark everything else as buggy too, which is ugly.

> Should I make each CC into a separate interface required by the program
> (and its dependencies) that only injects some value for CC into the
> environment and similarly for CFLAGS? I could also create separate
> executables from the same source with different compiler flags but the
> same would have to be done for each dependency also which would
> duplicate a lot of interface code. Are there any other options for doing
> this?

If your programs use $CC rather than specifying a 0install dependency
then it's actually easier. You could use 0test to run your build
command with each possible environment, e.g.

0test -t 'run-my-test-builds' http://example.org/gcc 4.0 5.0


-- 
Dr Thomas Leonard        http://roscidus.com/blog/
GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA

------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.