dspinellis / dgsh

Shell supporting pipelines to and from multiple processes
http://www.spinellis.gr/sw/dgsh/
Other
323 stars 22 forks source link

Support running tests without installing dgsh #67

Closed lucaswerkmeister closed 7 years ago

lucaswerkmeister commented 7 years ago

Currently, some tests seem to assume that the built program has already been installed. That is, they seem to assume the following workflow:

Both dh (Debian) and makepkg (Arch), however, run the tests before the “install” step:

For building packages for these distributions, it would be good if the latter sequence was supported.

In particular:


Aside: do you have a chat channel or similar for dgsh? I have some other packaging concerns that I’d like to discuss with you…

lucaswerkmeister commented 7 years ago

Actually, I had misunderstood packaging, sorry… $(PREFIX) should be /usr, and the package build tool-specific directory only comes into play in the make install step, as DESTDIR. I’ll check if the tests work better with those changes.

dspinellis commented 7 years ago

Tests should be able to run now (modulo portability issues) without requiring the programs to be installed.

lucaswerkmeister commented 7 years ago

Okay, the Bash tests work now, but the first “paper example” fails with “dir.sh failed”.

lucaswerkmeister commented 7 years ago

Okay, lots of commands are giving “bad interpreter” errors:

/usr/libexec/dgsh/df: /home/lucas/git/aur/dgsh-git/pkg/dgsh-git/usr//libexec/dgsh/dgsh-wrap: bad interpreter: No such file or directory

dspinellis commented 7 years ago

Thank you for the input! Is there a file named /home/lucas/git/aur/dgsh-git/pkg/dgsh-git/usr//libexec/dgsh/dgsh-wrap? What about /home/lucas/git/aur/dgsh-git/pkg/dgsh-git/usr/libexec/dgsh/dgsh-wrap? (Without the double slash.) Will this be the final location of the commands? I doubt it. I wonder why the wrong path has been hardcoded in the commands. Is there a way to obtain the actual final installation location?

lucaswerkmeister commented 7 years ago

No, the pkg directory is completely empty at this point, and I’m not sure how the path got in there. There are dgsh-wrap files in /home/lucas/git/aur/dgsh-git/src/dgsh/core-tools/src/ and …/src/dgsh/build/libexec/dgsh/. (makepkg clones the dgsh repository into src/dgsh, everything before src is the folder where I’m running makepkg.)

dspinellis commented 7 years ago

The reason you get the bad interpreter error is because the pkg directory is empty, so the file cannot be found. The path is being created by the unix-tools/install-wrapped.sh. We can avoid the explicit path at the cost of an additional exec system call, by replacing the hard-coded path of the interpreter with #!/usr/bin/env dgsh-wrap ... and ensuring dgsh-wrap is in the path. What do you think?

lucaswerkmeister commented 7 years ago

Well, I’m still confused why pkg shows up in there at all, that directory shouldn’t be mentioned until we get to the install phase (and check is before that). But I can’t investigate that right now because there seems to be a build error:

make -C unix-tools make MAKEFLAGS=
make[1]: Entering directory '/home/lucas/git/aur/dgsh-git/src/dgsh/unix-tools'
make[1]: *** No rule to make target '../core-tools/src/libdgsh.a', needed by 'w'.  Stop.
make[1]: Leaving directory '/home/lucas/git/aur/dgsh-git/src/dgsh/unix-tools'
make: *** [Makefile:78: unix-tools] Error 2
mfragkoulis commented 7 years ago

That's odd, the libdgsh.a library should have been built already. Could you please post the entire log of a fresh clean compile?

lucaswerkmeister commented 7 years ago

Sure, here it is (includes configure step, too): https://gist.github.com/lucaswerkmeister/dd87df3f529ca292a47180036c648abb

And here’s the build script, by the way: https://github.com/lucaswerkmeister/dgsh-git-aur – I think a few non-Arch distros package the Arch build tools as well (at least Fedora does, I hear), and just running makepkg in that directory should yield the same result. (It will take a while if you don’t have some sort of -jN configured in your MAKEFLAGS in /etc/makepkg.conf.)

mfragkoulis commented 7 years ago

Thanks! I just scanned the log you provided, but I couldn't spot the build error you mentioned. For the build error you mentioned, the corresponding target (line no 11665, 11666) seems to have nothing more to do. make enters and exits immediately. Is it a clean compile? Also, I didn't find the execution of the target make -C unix-tools build-install The last line I see in the log is no 11229. Is it the full output?

lucaswerkmeister commented 7 years ago

Oh, my bad, apparently the error is printed to stderr, which I didn’t include. I’ll do another run.

lucaswerkmeister commented 7 years ago

https://gist.github.com/lucaswerkmeister/54a067dc101b87d17211aa23a05b4ebc

mfragkoulis commented 7 years ago

There was an implicit dependency within the unix-tools Makefile to libdgsh.a, which is built in core-tools. Because the dependency was not made explicit to make, the latter parallelised the execution of make -C core-tools with make -C unix-tools. Please pull and re-run.

lucaswerkmeister commented 7 years ago

Okay, thanks, that fixed the build – now we’re back to test failures. Here’s the tail of the output (no errors before that, it seems): https://gist.github.com/lucaswerkmeister/62feb35787af5c7e338d2bfca9c58f78

There are also sixteen coredump files (four for conftest, twelve for dgsh-w), which I can send to you if you’d like.

(I guess we could also move this to a new issue by this point…)

mfragkoulis commented 7 years ago

I refactored dgsh-w. Please pull and try again. If the problem persists, please also randomly select, say, 3 coredump files of dgsh-w processes and post them.

lucaswerkmeister commented 7 years ago

Thanks, that seems to have fixed it. Now there’s a path error, apparently:

which: no sfimag in (/home/lucas/git/aur/dgsh-git/src/dgsh/build/bin:/home/lucas/bin:/usr/local/sbin:/usr/local/bin:/usr/bin)
Skip test ft2d.sh
ft2d.sh successful
which: no nmrPipe in (/home/lucas/git/aur/dgsh-git/src/dgsh/build/bin:/home/lucas/bin:/usr/local/sbin:/usr/local/bin:/usr/bin)
Skip test NMRPipe.sh
NMRPipe.sh failed
make[1]: *** [Makefile:156: test-bash] Error 1
make: *** [Makefile:113: test-unix-tools] Error 2
==> ERROR: A failure occurred in check().

There are no files named sfimag or nmrPipe anywhere in the build directory. Might be another race condition due to undeclared dependencies – I’ll try a -j1 build. EDIT: Nope, same error.

mfragkoulis commented 7 years ago

It's fair not to find sfimag or nmrPipe because they are available with specific libraries not found by default in typical systems. This is why NMRPipe.sh test is skipped as we would expect. However, from the following line it is evident that it is not actually skipped, but executed anyway. Then the test fails as it should, because it depends on programs not installed in the system. An exit command when a test is skipped was missing from the script that runs the tests. Can you please pull and try again?

lucaswerkmeister commented 7 years ago

And now the build fully succeeded – thank you very much!

Shall I publish the AUR package now?

mfragkoulis commented 7 years ago

Are you OK with issue #70 ? I am working on it now.

lucaswerkmeister commented 7 years ago

Oh, right, I’m currently still removing that in the PKGBUILD… if you want to fix the issue on your end first, I’ll wait for that.