VIDA-NYU / reprozip

ReproZip is a tool that simplifies the process of creating reproducible experiments from command-line executions, a frequently-used common denominator in computational science.
https://www.reprozip.org/
BSD 3-Clause "New" or "Revised" License
303 stars 33 forks source link

simple test example for repro[un]zip #242

Closed ghisvail closed 6 years ago

ghisvail commented 7 years ago

In my effort to package the reprozip tools for Debian / Ubuntu, I was wondering whether you could provide a simple test example (helloworld style) which could help validate the reprozip / reprounzip packages?

Thanks,

remram44 commented 7 years ago

ReproZip actually has functional tests (tests/functional.py) that build and run a number of simple C programs that exhibit various behaviors to test the tracer. You can also run simple UNIX tools such as echo, id, ...

The testrun command doesn't leave files behind and prints out the collected information to standard output, so it might be what you want.

Example: ``` $ reprozip testrun /bin/echo ------------------------------------------------------------------------------- Processes: +------+--------+-------+------------------+ | id | parent | exit | timestamp | +------+--------+-------+------------------+ | 1 | | 0 | 139812602867 | +------+--------+-------+------------------+ Executed files: +--------+------------------+---------+---------------------------------------+ | id | timestamp | process | name and argv | +--------+------------------+---------+---------------------------------------+ | 1 | 139813037567 | 1 | /bin/echo | +--------+------------------+---------+---------------------------------------+ Files: +--------+------------------+---------+------+--------------------------------+ | id | timestamp | process | mode | name | +--------+------------------+---------+------+--------------------------------+ | 1 | 139812609134 | 1 | 4 | /home/vagrant | +--------+------------------+---------+------+--------------------------------+ | 2 | 139812611661 | 1 | 4 | /home/vagrant | +--------+------------------+---------+------+--------------------------------+ | 3 | 139813094010 | 1 | 1 | /lib/x86_64-linux-gnu/ld-2.23.so | +--------+------------------+---------+------+--------------------------------+ | 4 | 139813214337 | 1 | 1 | /etc/ld.so.cache | +--------+------------------+---------+------+--------------------------------+ | 5 | 139813278625 | 1 | 1 | /lib/x86_64-linux-gnu/libc.so.6 | +--------+------------------+---------+------+--------------------------------+ | 6 | 139813690899 | 1 | 1 | /usr/lib/locale/locale-archive | +--------+------------------+---------+------+--------------------------------+ ```

For reprounzip, there are a number of packages that get tested in the functional tests, you can for instance grab this one: https://drive.google.com/uc?export=download&id=0B3ucPz7GSthBRGp2Vm5VQVpWOGs and either run simple commands (info/showfiles) or actually extract it.

Example: ``` $ curl -Lo simple.rpz 'https://drive.google.com/uc?export=download&id=0B3ucPz7GSthBRGp2Vm5VQVpWOGs' $ reprounzip info simple.rpz Pack file: simple.rpz ----- Pack information ----- Compressed size: 883.66 KB ----- Metadata ----- Total software packages: 1 Packed software packages: 1 Architecture: x86_64 (current: x86_64) Distribution: debian 8.1 (current: Ubuntu 16.04) Runs (1): ./simple /home/remram/Documents/programming/reprozip/reprozip/tests/simple_input.txt simple_output.txt Inputs/outputs files (2): arg1, arg2 ----- Unpackers ----- Compatible (4): chroot graph directory docker ```
remram44 commented 7 years ago

Let us know if you need help with anything else. We are excited for the opportunity to make it into the Debian repository!

I was considering building DEB packages myself last year (branch debian) to go with our Windows/macOS installers, but never got to it.

ghisvail commented 7 years ago

We are excited for the opportunity to make it into the Debian repository!

Glad to hear about that :-)

ReproZip actually has functional tests [...]

Since I'll be sourcing reprozip, reprounzip et al from the release tarballs on PyPI, I won't have access to those, right?

The testrun command doesn't leave files behind and prints out the collected information to standard output, so it might be what you want.

Absolutely.

For reprounzip, there are a number of packages that get tested [...]

I would preferably want to avoid relying on pre-generated archives, because either they have to be embedded to the packaging (thereby significantly increasing the size of the resulting source package) or fetched remotely, which raises concerns of the persistence of the data long term.

Instead, I was thinking that the packaging for reprounzip could be validated via some sort of round-trip test on a locally generated archive via the packaged reprozip, hence the request for an helloworld style example. I could also a use a variation of the test suite residing in tests, but would probably need help to extract the relevant subset of code and making it runnable standalone. Bonus points for using an established test framework, preferably pytest.

remram44 commented 7 years ago

Since I'll be sourcing reprozip, reprounzip et al from the release tarballs on PyPI, I won't have access to [the functional tests]

Well, the problem is that the tests use all the components, and therefore it doesn't make a lot of sense to bundle them with any single one.

If the reprounzip tests can depend on reprozip, making up a simple round-trip is easy, but running the full test suite should be possible.

My unit tests use the unittest library (should be compatible with pytest), but the functional tests don't (they have options for what to run, and are not split into simple self-contained tests, mostly for speed).

Example round-trip: ``` $ reprozip -v trace /bin/echo [REPROZIP] 17:03:14.348 INFO: Running program [REPROZIP] 17:03:14.349 INFO: child created, pid=2309 [REPROZIP] 17:03:14.355 INFO: process 2309 created by initial fork() [REPROZIP] 17:03:14.356 INFO: 1 processes (inc. 0 unattached) [REPROZIP] 17:03:14.357 INFO: [2309] successfully exec'd /bin/echo [REPROZIP] 17:03:14.359 INFO: [2309] process exited (code 0), 0 processes remain [REPROZIP] 17:03:14.369 INFO: Program completed [REPROZIP] 17:03:14.397 INFO: Running filter plugin python [REPROZIP] 17:03:14.399 INFO: Running filter plugin builtin [REPROZIP] 17:03:14.441 INFO: Identifying Debian packages for 8 files... [REPROZIP] 17:03:16.318 INFO: 2 packages with 4 files, and 4 other files Configuration file written in .reprozip-trace/config.yml Edit that file then run the packer -- use 'reprozip pack -h' for help $ reprozip -v pack echo.rpz [REPROZIP] 17:03:22.435 INFO: Identifying Debian packages for 0 files... [REPROZIP] 17:03:23.540 INFO: 0 packages with 0 files, and 0 other files [REPROZIP] 17:03:23.541 INFO: Creating pack echo.rpz... [REPROZIP] 17:03:23.550 INFO: Adding files from package coreutils... [REPROZIP] 17:03:23.560 INFO: Adding files from package libc6... [REPROZIP] 17:03:23.846 INFO: Adding other files... [REPROZIP] 17:03:24.700 INFO: Adding metadata... $ reprounzip -v -v info echo.rpz Pack file: echo.rpz ----- Pack information ----- Compressed size: 1.47 MB Unpacked size: 4.87 MB Total packed paths: 17 Files: 5 Directories: 10 Symbolic links: 2 ----- Metadata ----- Total paths: 8 Listed packed paths: 8 Total software packages: 2 Packed software packages: 2 Files from packed software packages: 4 Files from unpacked software packages: 0 Architecture: x86_64 (current: x86_64) Distribution: Ubuntu 16.04 (current: Ubuntu 16.04) Runs (1): /bin/echo wd: /home/vagrant exitcode: 0 ----- Unpackers ----- Compatible (5): chroot graph directory docker installpkgs Unknown (1): vagrant (vagrant not found in PATH) $ reprounzip -v -v directory setup echo.rpz echo/ [REPROUNZIP] 17:03:50.182 INFO: Extracting files... [REPROUNZIP] 17:03:50.240 INFO: Writing VisTrails workflow echo/vistrails.vt... $ reprounzip -v -v directory run echo/ /sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once /sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once /sbin/ldconfig.real: /lib/x86_64-linux-gnu/ld-2.23.so is the dynamic linker, ignoring [REPROUNZIP] 17:03:57.370 WARNING: Rewrote command-line as: /home/vagrant/echo/root/bin/echo *** Command finished, status: 0 $ reprounzip -v -v directory destroy echo/ [REPROUNZIP] 17:04:05.697 INFO: Removing directory echo... ```
ghisvail commented 7 years ago

All good for the reprozip packaging. Now moving on to reprounzip.

Your pointers have been very helpful.

ghisvail commented 7 years ago

FYI, both reprozip and reprounzip are now available in Debian

remram44 commented 7 years ago

Awesome! I can't see reprounzip just yet.

Are the plugins (reprounzip-docker and reprounzip-vagrant) packaged with reprounzip?

ghisvail commented 7 years ago

Awesome! I can't see reprounzip just yet.

It was accepted only a few hours ago.

Are the plugins (reprounzip-docker and reprounzip-vagrant) packaged with reprounzip?

They are next in line. I'll ask you for corresponding roundtrip tests for each.

Thanks, Ghis

remram44 commented 7 years ago

On a related note, should we provide manpages?

ghisvail commented 7 years ago

Yes please. I'd suggest a simple Sphinx based setup with just the man command for each package registered on PyPI.