hone / mruby-cli

mruby-cli is a platform to build native command line applications for Linux, Windows, and OS X. It provides the tools necessary for building a standalone binary of your application from any machine. Take advantage of the power of Ruby without the cross-platform dependency headaches that go with it.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bintest returning strange errors

adelevie opened this issue · comments

First off, this library is great! I am having so much fun with it. I'm almost done with my first CLI and I am writing some tests. Unit tests work fine, but docker-compose run bintest is returning some strange looking errors:

Here's my bintest file:

require 'open3'

BIN_PATH = File.join(File.dirname(__FILE__), "../mruby/bin/pdfq")

assert('trivial') do
  assert true
end

And the output:

XFF
LocalJumpError: true => no block given (yield)
Fail: trivial
Fail: Compiling multiple files without new line in last line. #2361
 - Assertion[1] Failed: Expected to be equal
    Expected: "bin\\mrbc.exe:/tmp/a.rb20151012-73-1jn9der:Syntax OK"
      Actual: "sh: 1: binmrbc.exe: not found"
 - Assertion[2] Failed: Expected to be equal
    Expected: 0
      Actual: 127
Total: 3
   OK: 0
   KO: 2
Crash: 1
 Time: 0.01 seconds
/home/mruby/code/mruby/test/report.rb:3:in `<top (required)>': mrbtest failed (KO:2, Crash:1) (RuntimeError)
    from test/bintest.rb:18:in `load'
    from test/bintest.rb:18:in `<main>'
rake aborted!
Command failed with status (1): [ruby test/bintest.rb "/home/mruby/code" "/...]
/home/mruby/code/mruby/tasks/mruby_build.rake:276:in `run_bintest'
/home/mruby/code/Rakefile:52:in `block (4 levels) in <top (required)>'
/home/mruby/code/Rakefile:42:in `clean_env'
/home/mruby/code/Rakefile:51:in `block (3 levels) in <top (required)>'
/home/mruby/code/mruby/tasks/mruby_build.rake:13:in `instance_eval'
/home/mruby/code/mruby/tasks/mruby_build.rake:13:in `block in each_target'
/home/mruby/code/mruby/tasks/mruby_build.rake:12:in `each'
/home/mruby/code/mruby/tasks/mruby_build.rake:12:in `each_target'
/home/mruby/code/Rakefile:50:in `block (2 levels) in <top (required)>'
Tasks: TOP => test:bintest
(See full trace by running task with --trace)

Hi @adelevie, this is linked to #23 (see the fix at zzak/mruby-cli-docker@6df6d15). It's still not yet merge in the corresponding docker image.

In the meantime, you can add SHELL /bin/bash to your Dockerfile.

Thanks, @toch! I'll try that right now and report back.

Update: After adding the SHELL ... line to the Dockerfile, do I need to do anything to re-pull any images? (Sorry, I'm still a bit new to Docker and docker-compose).

@adelevie you need to remove the mruby-cli images.

try this

docker rmi -f `docker images | grep mrubycli_ | cut -d\t -f1`

it will remove every docker image for mruby-cli (but not the base one).

Ok thanks. And just to be sure, my Dockerfile should look like:

FROM hone/mruby-cli
ENV SHELL /bin/bash

?

➜  pdfq git:(master) ✗ docker rmi -f `docker images | grep mrubycli_ | cut -d\t -f1`
docker: "rmi" requires a minimum of 1 argument.
See 'docker rmi --help'.

Usage:  docker rmi [OPTIONS] IMAGE [IMAGE...]

Remove one or more images
➜  pdfq git:(master) ✗ docker images | grep mrubycli_ | cut -d\t -f1
➜  pdfq git:(master) ✗ 

@adelevie yes your Dockerfile is correct

could you report the docker images listing please?

➜  pdfq git:(master) docker images
REPOSITORY                TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
pdfq_test                 latest              99b2ddd40c30        About an hour ago   1.816 GB
pdfq_clean                latest              99b2ddd40c30        About an hour ago   1.816 GB
pdfq_shell                latest              20e65bf09d15        16 hours ago        1.816 GB
pdfq_bintest              latest              20e65bf09d15        16 hours ago        1.816 GB
pdfq_compile              latest              20e65bf09d15        16 hours ago        1.816 GB
pdfq_mtest                latest              20e65bf09d15        16 hours ago        1.816 GB
hello_compile             latest              20e65bf09d15        16 hours ago        1.816 GB
hello-world               latest              af340544ed62        9 weeks ago         960 B
hone/mruby-cli            latest              d29763ca2c9e        10 weeks ago        1.816 GB
dockercomposedjango_web   latest              a391466f4e9d        3 months ago        703.3 MB
python                    2.7                 0d1c644f790b        3 months ago        673 MB
iaagem_iaa                latest              233c826b9d0f        3 months ago        884.4 MB
<none>                    <none>              1e61e2cdcfc9        3 months ago        884.4 MB
ruby                      2.1.6               5737c57aefc8        3 months ago        785.6 MB
postgres                  latest              7bf0ec35adaf        3 months ago        214 MB

right sorry, you're working on a new mruby-cli app I guess. right?

I guess it's pdfq, because of the mruby-cli suffix test, clean, shell, bintest, compile, and mtest.

So the right command is

docker rmi -f `docker images | grep pdfq_ | cut -d\t -f1

Sorry for the confusion.

➜  pdfq git:(master) ✗ docker rmi -f `docker images | grep pdfq_ | cut -d\t -f1`
Untagged: pdfq_clean:latest
Error response from daemon: No such image: la
Error response from daemon: No such image: pdfq_
Error response from daemon: No such image: pdfq_bin
Untagged: pdfq_shell:latest
Error response from daemon: No such image: la
Untagged: pdfq_compile:latest
Error response from daemon: No such image: la
Error response from daemon: No such image: pdfq_m
Error: failed to remove images: [la pdfq_ pdfq_bin la la pdfq_m]

Here's the repo that I just pushed to: https://github.com/adelevie/pdfq

@adelevie I don't get why you got that error. Anyway, check that you do not have anymore the images I've listed before, especially pdfq_bintest, pdfq_test, and pdfq_mtest. The next time you'll do a docker-compose, the docker image will be rebuilt and take in account your change in the Dockerfile.

Ok great, thanks so much for the help!

Do you still have the errors you have initially reported now?

Just manually removed the docker images and it all works! Thanks so much!

commented

I actually pushed the tag to docker hub, but the commit hasn't been merged into the upstream repo yet.