On 24-04-13 14:34, Erik de Castro Lopo wrote:> That's an error in the awk script, which is embedded in the shell > script. I know GNU awk supports lshift, maybe BSD awk doesn't. I'll > investigate that futher.On my system awk links to mawk 1.3.3>> I don't know why, but the test continues and says all tests passed while >> that clearly isn't the case. > When the error is detected in the shell script it does abort. I'll look > at that more closely after I've figured out the lshift issue.awk stops, but the script keeps running here. For some reason exit (and die) don't function inside this loop.
Martijn van Beurden wrote:> On 24-04-13 14:34, Erik de Castro Lopo wrote: > > That's an error in the awk script, which is embedded in the shell > > script. I know GNU awk supports lshift, maybe BSD awk doesn't. I'll > > investigate that futher. > > On my system awk links to mawk 1.3.3Yep fails on my system with maxk 1.3.3 too. Do you have any other versions om awk on your system? Gawk maybe?> awk stops, but the script keeps running here. For some reason exit (and > die) don't function inside this loop.The problem is that the failure in the awk script isn't recognised as a failure in the shell script. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Erik de Castro Lopo wrote:> Martijn van Beurden wrote: > > > On 24-04-13 14:34, Erik de Castro Lopo wrote: > > > That's an error in the awk script, which is embedded in the shell > > > script. I know GNU awk supports lshift, maybe BSD awk doesn't. I'll > > > investigate that futher. > > > > On my system awk links to mawk 1.3.3 > > Yep fails on my system with maxk 1.3.3 too. > > Do you have any other versions om awk on your system? Gawk maybe? > > > awk stops, but the script keeps running here. For some reason exit (and > > die) don't function inside this loop. > > The problem is that the failure in the awk script isn't recognised as > a failure in the shell script.Well I haven't fixed the problem with the shell script not recognising the failure of the awk script, but I have fixed the awk script in this commit: commit 69c44a51de295a6eb91ab0fdb1777d222395dab0 Author: Erik de Castro Lopo <erikd at mega-nerd.com> Date: Thu Apr 25 13:53:21 2013 +1000 test/test_metaflac.sh: POSIXify embedded awk script. The embedded awk script was using the 'lshift' function which apparently only exists in GNU auk (gawk) and definitely does not exist in mawk. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
On 25-04-13 05:30, Erik de Castro Lopo wrote:> The problem is that the failure in the awk script isn't recognised as > a failure in the shell script.No, really, it's not only that. With the fixed git, I get this when I change one of the expected values to something else:> [...] > Testing FLAC file with unknown metadata... OK > Testing FLAC replaygain 8000 (8000 x 1) ... OK > Testing FLAC replaygain 11025 (11025 x 1) ... OK > Testing FLAC replaygain 11025 (11025 x 1) ... OK > Testing FLAC replaygain 12000 (12000 x 1) ... OK > Testing FLAC replaygain 16000 (16000 x 1) ... OK > Testing FLAC replaygain 18900 (18900 x 1) ... OK > Testing FLAC replaygain 22050 (22050 x 1) ... OK > Testing FLAC replaygain 24000 (24000 x 1) ... OK > Testing FLAC replaygain 28000 (28000 x 1) ... OK > Testing FLAC replaygain 32000 (32000 x 1) ... ERROR, Expected -14.00 > db instead of comment[1]: REPLAYGAIN_TRACK_GAIN=-14.08 dB > OK > Testing FLAC replaygain 36000 (36000 x 1) ... OK > Testing FLAC replaygain 37800 (37800 x 1) ... OK > Testing FLAC replaygain 44100 (44100 x 1) ... OK > Testing FLAC replaygain 48000 (48000 x 1) ... OK > Testing FLAC replaygain 96000 (48000 x 2) ... OK > Testing FLAC replaygain 192000 (48000 x 4) ... OK > [...]The test just keeps going! Try this snippet> find * | while read FILE; do if [ "${FILE: -4}" = "flac" ]; then echo > "FLAC file found"; exit 1; fi; done; echo "No FLAC file found"If there are any FLAC files in the directory you try this, it will say FLAC file found, but it will also return No FLAC file found because it seems exit only exits the loop. I also found a possible solution: using set -e just above that replaygain test for loop. That should exit the whole script if a single line returns an non-zero exit status, which makes it possible to let 'exit' abort not only the loop but the whole script. Maybe there are prettier solutions however?