Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set up and/or use Busted properly? #286

Closed
Frenzie opened this issue Nov 29, 2014 · 15 comments
Closed

How to set up and/or use Busted properly? #286

Frenzie opened this issue Nov 29, 2014 · 15 comments
Labels

Comments

@Frenzie
Copy link
Member

Frenzie commented Nov 29, 2014

make test uses the -l flag which seems to have been removed. I winged it for util_spec.lua by defining the function in my test file itself, but for more complicated stuff that won't do. Besides, I imagine this will affect the automated builds as well at some point in the future.

@hwhw
Copy link
Member

hwhw commented Nov 29, 2014

Yes, I stumbled upon that, too. Even tried to fix it for busted v.2, but something wasn't quite working.
Well, so the answer for now is hidden here:https://github.com/hwhw/koreader/blob/a82bafc63cdb41ca7266aef210fb8fddad87c31b/.travis.yml#L17

@Frenzie
Copy link
Member Author

Frenzie commented Nov 29, 2014

I was thinking of doing something like that, but I figured I'd ask first. The only alternative I could think of is to compile/set up LuaRocks itself in place with some custom buildflags. A quick look at the configure script suggests something like --lua-suffix=jit, but there would need to be a few other flags as well. I kind of hope I'm overlooking something more obvious because that -l switch from the older version sounds really simple and useful.

@Frenzie
Copy link
Member Author

Frenzie commented Nov 29, 2014

Something's still not right about my setup. Do you perhaps know what it could be?

make test has an issue I don't understand. make testfront reports being all successful, except the debug messages show all kinds of failures (interrupted for brevity).

screenshot-20141129-busted

@chrox
Copy link
Member

chrox commented Nov 30, 2014

Do you have libssl1.0.0 installed? Zyre depends on libssl. We build libssl.so.1.0.0 and libcrypto.so.1.0.0 in koreader-base but use system installed ones at running time because we assume they are installed on regular system. Probably my assumption is wrong then we need to install these two lib into the koreader/libs directory.

@Frenzie
Copy link
Member Author

Frenzie commented Nov 30, 2014

I have both libssl 0.9.8 and 1.0.0 installed on that (X)ubuntu laptop.

@hwhw
Copy link
Member

hwhw commented Nov 30, 2014

The error in the screen shot that is relevant is mainly this: Too many open files. That is probably a ulimit getting in the way (on Ubuntu, I had to increase the default 1024 files limit). The cannot load document is a stupid one that we should really get rid of. It is a bad pointer resolution in mupdf, I think within libk2pdfopt. It should not hinder the correct working, though it might create bad memory reads.

@Frenzie
Copy link
Member Author

Frenzie commented Nov 30, 2014

Huh, there's an interesting difference. My desktop, Debian Jessie:

$ ulimit -n
65536

My laptop, Xubuntu 14.10:

$ ulimit -n
1024

Sticking frans soft nofile 4096 in /etc/security/limits.conf seems to do the trick. Oddly enough, however, I didn't notice that the error had changed. This was the original, apparently less clear error:

frans@frenzie-laptop:~/src/koreader-dev/koreader$ make test
make -C base test
make[1]: Entering directory '/home/frans/src/koreader-dev/koreader/base'
test -e build/x86_64-linux-gnu/.busted || \
    ln -sf ../../.busted build/x86_64-linux-gnu/
cd build/x86_64-linux-gnu && busted -l ./luajit

●●●●●●●●●●●●●●●●●●●●●●●●●○ * zre_msg: OK
 * zyre_peer: D: 14-11-30 15:10:02 ZRE_MSG_HELLO:
D: 14-11-30 15:10:02     sequence=1
D: 14-11-30 15:10:02     endpoint='tcp://127.0.0.1:5552'
D: 14-11-30 15:10:02     groups=
D: 14-11-30 15:10:02     status=0
D: 14-11-30 15:10:02     name=''
D: 14-11-30 15:10:02     headers=
OK
 * zyre_group: D: 14-11-30 15:10:02 ZRE_MSG_HELLO:
D: 14-11-30 15:10:02     sequence=1
D: 14-11-30 15:10:02     endpoint='tcp://127.0.0.1:5552'
D: 14-11-30 15:10:02     groups=
D: 14-11-30 15:10:02     status=0
D: 14-11-30 15:10:02     name=''
D: 14-11-30 15:10:02     headers=
OK
 * zyre_node: OK
 * zyre_event: OK (skipping test, no UDP discovery)
luajit: ../../src/zsockopt.c:951: zsocket_set_linger: Assertion `rc == 0 || zmq_errno () == (156384712 + 53)' failed.
 * zyre: Aborted (core dumped)
Makefile:643: recipe for target 'test' failed
make[1]: *** [test] Error 134
make[1]: Leaving directory '/home/frans/src/koreader-dev/koreader/base'
Makefile:93: recipe for target 'test' failed
make: *** [test] Error 2

Anyway, busted itself is now running okay on my laptop. I now get three "proper" test failures.

  1. KOPTContext module / should get OCR word from tesseract OCR engine I assume that's because I didn't add any language files.
  2. Pic module / JPG support / should be able to get image size
  3. Pic module / JPG support / should render JPG as inverted BB properly

PS On my much faster desktop I'm still stuck, unfortunately. Although I removed busted and then installed v1.10 it doesn't seem to like flags ./luajit: /usr/local/bin/busted_bootstrap:3: unexpected symbol near '-'

@hwhw
Copy link
Member

hwhw commented Nov 30, 2014

Oh, yes, the JPEG errors. Will check those. They are the result from reworking the pic module for JPEGs.

I had the same error, and I got it off by removing even the last trace of busted-2. In vain, I must have tried a bit too much, and I just killed luarocks and all its packages completely, then reinstalled luarocks and busted (v.1.10).

hwhw added a commit to hwhw/koreader-base that referenced this issue Nov 30, 2014
This will stop linking and (trying to) using mupdf in libk2pdfopt.
We didn't use the functionality anyway, and it produced funny error
messages (see koreader#288, koreader#286).

Needs koreader/libk2pdfopt#24

Fixes koreader#288
hwhw added a commit to hwhw/koreader-base that referenced this issue Nov 30, 2014
This will stop linking and (trying to) using mupdf in libk2pdfopt.
We didn't use the functionality anyway, and it produced funny error
messages (see koreader#288, koreader#286).

Needs koreader/libk2pdfopt#24

Fixes koreader#288
@Frenzie
Copy link
Member Author

Frenzie commented Nov 30, 2014

I'm still getting the same error after running sudo luarocks remove busted and purging and reinstalling luarocks. :/

I tried to succinctly compile the information in https://github.com/koreader/koreader-base/wiki/Unit-testing

@hwhw
Copy link
Member

hwhw commented Nov 30, 2014

I suggest you check twice what busted (and busted_bootstrap) executable is there. IIRC, the uninstall via luarocks left some things, and I really made sure to remove any traces of busted and other luarocks stuff by hand ("rm", that is).

@Frenzie
Copy link
Member Author

Frenzie commented Nov 30, 2014

I think the error must be related to luarocks 2.2.0 in Debian Jessie vs 2.0.9 in Ubuntu 14.10. It would appear that the newer luarocks ties in more closely with whatever Lua it was "installed" with or something. I'd already double-checked that everything was removed, but as it turns out sudo luarocks make results in a different busted_bootstrap file. On my desktop it turns into this:

#!/bin/sh

exec '/usr/bin/lua5.1' -e 'package.path="/root/.luarocks/share/lua/5.1/?.lua;/root/.luarocks/share/lua/5.1/?/init.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;"..package.path; package.cpath="/root/.luarocks/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/?.so;"..package.cpath' -e 'local k,l,_=pcall(require,"luarocks.loader") _=k and l.add_context("busted","1.11.1-0")' '/usr/local/lib/luarocks/rocks/busted/1.11.1-0/bin/busted_bootstrap' "$@"

So I fixed the problem manually with cp busted_bootstrap /usr/local/bin/busted_bootstrap. Incidentally, 1.11.1 reverts the removal of the -l option, so I figured I might as well check out the other included fixes. It makes no difference wrt the contents of the busted_bootstrap file and all of my previous attempts were using v1.10.0.

My desktop runs the tests significantly faster. 9 seconds for make test and 16 seconds for make testfront vs 18 and a whopping 75 seconds on my laptop. (Of course I didn't run all the tests all the time; don't worry. :P)

Edit: oh, 2.0.9 does the same thing for the main busted file in v2. Maybe it's the "generated script wrappers are now more robust" from 2.1.2 http://luarocks.org/en/Release_history

Edit 2: also see lunarmodules/busted#290

@Frenzie
Copy link
Member Author

Frenzie commented Nov 30, 2014

Okay, so I found a solution. In the rockspec, add these lines:

rockspec_format = "1.1"
deploy = { wrap_bin_scripts = false }

For v2 that allows for the slightly roundabout ./luajit /usr/local/bin/busted; for v1 a simple busted -l ./luajit.

@hwhw
Copy link
Member

hwhw commented Nov 30, 2014

Oh, great! Maybe we should fork busted, even if just for the sake of updating the rockspec or the wrapper, respectively?

@Frenzie
Copy link
Member Author

Frenzie commented Dec 1, 2014

It looks like besides through individual rockspecs, wrappers can also be disabled in luarock's global config file (see at the bottom here). Whatever's the most convenient. If you wanted to use busted v2 in the Travis VM it'd probably suffice to stick in something like echo "wrap_bin_scripts = false" >> /etc/luarocks/config.lua after installing luarocks and before installing busted. Locally I'm not sure.

@chrox
Copy link
Member

chrox commented Aug 14, 2016

Please refer to the ci scripts.

@chrox chrox closed this as completed Aug 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants