Skip to content

gopherjs test -c : doesn't not compile more than one file #764

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
morndiaye opened this issue Feb 26, 2018 · 3 comments
Closed

gopherjs test -c : doesn't not compile more than one file #764

morndiaye opened this issue Feb 26, 2018 · 3 comments
Labels
bug gopherjs-tool Related to the gopherjs tool or its build system (but not the compiler itself). NeedsFix

Comments

@morndiaye
Copy link

I'm trying to generate list of *_test.js but it seem that only the first _test.go is building.
"gopherjs test" is able to run list of tests but "gopherjs test -c" compile only one test instead of compiling all the tests.

@dmitshur dmitshur added gopherjs-tool Related to the gopherjs tool or its build system (but not the compiler itself). WaitingForInfo NeedsInvestigation labels Feb 26, 2018
@dmitshur
Copy link
Member

Resolving this would be easier with more clear reproduction steps (e.g., what was the exact code you tried it on, what exact commands did you run, what output did you get, etc.).

@morndiaye
Copy link
Author

morndiaye commented Feb 27, 2018

I'm trying to generate javascript test and running in a browser.

what was the exact code:
I use cryptography libraries (xts and xtea part of the https://godoc.org/golang.org/x/crypto)

what exact commands did I run:

  1. Running test
    gopherjs test -v golang.org/x/crypto/xts golang.org/x/crypto/xtea
    Output:
    gopherjs: Source maps disabled. Install source-map-support module for nice stack traces. See https://github.com/gopherjs/gopherjs#gopherjs-run-gopherjs-test.
    === RUN TestXTS
    --- PASS: TestXTS (0.03s)
    === RUN TestShorterCiphertext
    --- PASS: TestShorterCiphertext (0.00s)
    PASS
    warning: system calls not available, see https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md
    ok golang.org/x/crypto/xts 0.383s
    gopherjs: Source maps disabled. Install source-map-support module for nice stack traces. See https://github.com/gopherjs/gopherjs#gopherjs-run-gopherjs-test.
    === RUN TestBlocksize
    --- PASS: TestBlocksize (0.00s)
    === RUN TestCipherInit
    --- PASS: TestCipherInit (0.00s)
    === RUN TestInvalidKeySize
    --- PASS: TestInvalidKeySize (0.00s)
    === RUN TestEncodeDecode
    --- PASS: TestEncodeDecode (0.00s)
    === RUN TestCipherEncrypt
    --- PASS: TestCipherEncrypt (0.00s)
    === RUN TestCipherDecrypt
    --- PASS: TestCipherDecrypt (0.00s)
    PASS
    warning: system calls not available, see https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md
    ok golang.org/x/crypto/xtea 0.387s

All tests are launched

  1. Generate javascript test
    gopherjs test -v -c golang.org/x/crypto/xts golang.org/x/crypto/xtea
    Output:
    -rw-rw-r-- 1 css css 1948315 Feb 27 16:50 xts_test.js
    -rw-rw-r-- 1 css css 81423 Feb 27 16:50 xts_test.js.map

In this part, only xts_test.js is generated instead of xts_test.js and xtea_test.js and it does not contain all tests.

Result of xts_test.js in a browser:
PASS xts_test.js:8891

@dmitshur
Copy link
Member

The gopherjs command mimics the CLI of the cmd/go command. In cmd/go, the -c flag can only be used on a single package a time. See:

$ go test -v golang.org/x/crypto/xts golang.org/x/crypto/xtea
=== RUN   TestXTS
--- PASS: TestXTS (0.00s)
=== RUN   TestShorterCiphertext
--- PASS: TestShorterCiphertext (0.00s)
PASS
ok  	golang.org/x/crypto/xts	0.007s
=== RUN   TestBlocksize
--- PASS: TestBlocksize (0.00s)
=== RUN   TestCipherInit
--- PASS: TestCipherInit (0.00s)
=== RUN   TestInvalidKeySize
--- PASS: TestInvalidKeySize (0.00s)
=== RUN   TestEncodeDecode
--- PASS: TestEncodeDecode (0.00s)
=== RUN   TestCipherEncrypt
--- PASS: TestCipherEncrypt (0.00s)
=== RUN   TestCipherDecrypt
--- PASS: TestCipherDecrypt (0.00s)
PASS
ok  	golang.org/x/crypto/xtea	0.008s
$ go test -v -c golang.org/x/crypto/xts golang.org/x/crypto/xtea
cannot use -c flag with multiple packages

You can just invoke gopherjs -c twice to get the results you want:

gopherjs test -v -c golang.org/x/crypto/xts
gopherjs test -v -c golang.org/x/crypto/xtea

This bug needs to be fixed by adding a "cannot use -c flag with multiple packages" error message when multiple packages are provided to gopherjs test -c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug gopherjs-tool Related to the gopherjs tool or its build system (but not the compiler itself). NeedsFix
Projects
None yet
Development

No branches or pull requests

2 participants