Re: Testing source code program with 0install
Thomas Leonard <[email protected]>
| Newsgroups | gmane.comp.file-systems.zero-install.devel |
|---|---|
| Message-ID | <CAG4opy_5wnD5Lh+Qwi3BdNnFkvYAX8K5c+Oo3UPWKcDEecQkqw@mail.gmail.com> |
On 4 September 2015 at 13:52, Ilja Honkonen <[email protected]> wrote: >>> 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. >> - 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. >>> 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 > > Thanks but is there a difference between $CC/0test and > 0install/0compile/etc? I'm not sure if your answers about XDG_DATA_HOME > and 0test are different things or different ways to do the same thing or > something else... If you want to compile your program with 0compile, then you need to set XDG_{DATA,CONFIG}_HOME to a temporary directory to store the results. Otherwise, they'll get added to the user's cache on the first attempt and it won't compile anything the second time. You have to do this whatever method you use. 0test might be useful to loop over versions of gcc, etc. However, if your distribution can already parallel-install multiple versions of gcc then you don't really need it. A loop in a bash script would do. If your programs depend on their compilers using 0install <requires> then, unfortunately, things get tricky because 0compile will override your $CC setting with whatever it considers best for that package. More work would be needed to support that. > If my program has a local feed a.xml and I run 0test gcc.xml 4.9 5.0 > a.xml how would I tell 0test to use given gcc version(s) for compiling > everything else given to 0test? In: 0test -t 'run-my-test-builds' http://example.org/gcc 4.0 5.0 0test would set $CC and run your "run-my-test-builds" script, for each version of gcc. However, this only works if the program *doesn't* specify the compiler dependency explicitly. "run-my-test-builds" would create a temporary directory, set XDG_*_HOME to point at it, and run "0compile autocompile" on the program to be tested. -- Dr Thomas Leonard http://roscidus.com/blog/ GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA ------------------------------------------------------------------------------