walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
600 stars 17 forks source link

Tests fail #22

Closed Nudin closed 4 years ago

Nudin commented 4 years ago

When trying to install in Arch via AUR the tests (go test github.com/walles/moar/m) fail:

--- FAIL: TestCodeHighlighting (0.24s)
panic: exit status 1 [recovered]
    panic: exit status 1

goroutine 94 [running]:
testing.tRunner.func1.1(0x6b2700, 0xc000304bc0)
    /usr/lib/go/src/testing/testing.go:941 +0x3d0
testing.tRunner.func1(0xc000186120)
    /usr/lib/go/src/testing/testing.go:944 +0x3f9
panic(0x6b2700, 0xc000304bc0)
    /usr/lib/go/src/runtime/panic.go:967 +0x166
github.com/walles/moar/m.TestCodeHighlighting(0xc000186120)
    /home/michi/.cache/yay/moar/src/moar-0.9.18/m/pager_test.go:174 +0x2ca
testing.tRunner(0xc000186120, 0x6d7a98)
    /usr/lib/go/src/testing/testing.go:992 +0xdc
created by testing.(*T).Run
    /usr/lib/go/src/testing/testing.go:1043 +0x357
FAIL    github.com/walles/moar/m    2.011s
FAIL
walles commented 4 years ago

Not entirely sure why since it works for me, but what it could be is that Highlight... http://www.andre-simon.de/doku/highlight/en/highlight.php ... isn't installed.

Could you do highlight --version?

Expected result is something like highlight version 3.55 and a bunch of more text.

Nudin commented 4 years ago

 highlight version 3.55
 Copyright (C) 2002-2020 Andre Simon <a dot simon at mailbox.org>

 Argparser class
 Copyright (C) 2006-2008 Antonio Diaz Diaz <ant_diaz at teleline.es>

 Artistic Style Classes (3.1)
 Copyright (C) 2006-2018 by Jim Pattee <jimp03 at email.com>
 Copyright (C) 1998-2002 by Tal Davidson

 Diluculum Lua wrapper (1.0)
 Copyright (C) 2005-2013 by Leandro Motta Barros

 xterm 256 color matching functions
 Copyright (C) 2006 Wolfgang Frisch <wf at frexx.de>

 This software is released under the terms of the GNU General Public License.
 For more information about these matters, see the file named COPYING.
walles commented 4 years ago

Next hypothesis: Maybe highlight fails for whatever reason on your system.

Can you see if either of these two commands fail? I'm unsure which file it actually tries to highlight...

Nudin commented 4 years ago

Both work. I suspected firejail could be the reason, so I disabled it for highlight but that makes no difference.

walles commented 4 years ago

So the facts are:

I see two options:

  1. The code is rewritten to add the highlight stderr output to the error object. That would probably produce an error message that's a lot more informative. Somewhere around here: https://github.com/walles/moar/blob/0fc6ee65f5387d9ce4403f2a09ba6bcd3d7b3245/m/reader.go#L69-L70
  2. You track this down some other way on your system.

What would you prefer?

walles commented 4 years ago

@Nudin, in 9a81e5ee62c8e413e052c0ebab1f1511ee547fe5 I have now implemented 1, so if you run the same tests on latest master you should get to know what highlight's problem is.

Can you try this and post the output here?

git clone git@github.com:walles/moar.git
cd moar
./test.sh
Nudin commented 4 years ago

Sorry for the troubles. Your patch revealed that the issue was bzip crashed:

    reader_test.go:137: Error reading file <../sample-files/compressed.txt.bz2>: Error: invalid /etc/hosts file
        Error: proc 88517 cannot sync with peer: unexpected EOF
        Peer 88518 unexpectedly exited with status 1: exit status 1

After debugging this further it turned out as a bug in firejail. I am sorry for wasting your time hunting an issue that isn't in your code.

walles commented 4 years ago

NP, I wanted to fix that error message anyway.

Thanks for your troubleshooting @Nudin!