Skip to content

.mll tests fail when running ./scripts/ninja.js build #5337

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

Closed
kevinbarabash opened this issue Nov 25, 2021 · 0 comments · Fixed by #5338
Closed

.mll tests fail when running ./scripts/ninja.js build #5337

kevinbarabash opened this issue Nov 25, 2021 · 0 comments · Fixed by #5338

Comments

@kevinbarabash
Copy link
Contributor

I get the following output when running ./scripts/ninja.js build (after running the other steps in CONTRIBUTING.md):

./scripts/ninja.js build
rescript: [91/1832] stubs/libbs_hash.a
+ cc -shared -flat_namespace -undefined suppress                    -Wl,-no_compact_unwind  -o stubs/dllbs_hash.so stubs/ext_basic_hash_stubs.o     
+ ar rc stubs/libbs_hash.a  stubs/ext_basic_hash_stubs.o; ranlib stubs/libbs_hash.a
rescript: [830/1832] test/arith_lexer.ml
FAILED: test/arith_lexer.ml
/bin/sh: test/arith_lexer.mll: Permission denied
rescript: [831/1832] test/number_lexer.ml
FAILED: test/number_lexer.ml
/bin/sh: test/number_lexer.mll: Permission denied
rescript: [834/1832] test/simple_lexer_test.ml
FAILED: test/simple_lexer_test.ml
/bin/sh: test/simple_lexer_test.mll: Permission denied
rescript: [1828/1832] test/unsafe_this.cmj
FAILED: cannot make progress due to previous errors.
Command failed: /Users/kevinbarabash/projects/rescript-compiler/darwin/ninja.exe native all
please run "./scripts/ninja.js config" first

The contents of jscomp/build.ninja is

subninja compiler.ninja
stdlib = stdlib-406
bsc = ../darwin/bsc.exe
subninja runtime/build.ninja
subninja others/build.ninja
subninja $stdlib/build.ninja
subninja test/build.ninja
o all: phony runtime others $stdlib test

which means that $ocamllex in jscomp/test/build.ninja is undefined. As a result when rule mll that makes use of $ocamllex tries to run, it instead ends up trying to execute the .mll files instead of running ocamllex.

rule mll
    command = $ocamllex $in
    generator = true

o test/arith_lexer.ml : mll test/arith_lexer.mll
o test/number_lexer.ml : mll test/number_lexer.mll
o test/simple_lexer_test.ml : mll test/simple_lexer_test.mll

I was able to fix this by updating ninja.js to include a line in jscomp/build.ninja that sets:

ocamllex = ocamllex.opt

I'm not familiar with the ninja build system so I'm not sure if this is the right fix. If it is, let me know and I can submit a PR with my change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant