Skip to content
New issue

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

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

Already on GitHub? # to your account

Windows: jasmine_node_test uses nodejs_test_macro #701

Merged
merged 2 commits into from
Apr 18, 2019

Conversation

laszlocsomor
Copy link
Contributor

Windows: jasmine_node_test uses nodejs_test_macro

Fix the jasmine_node_test() rule on Windows when
tested with Bazel's Windows-native test wrapper
(see bazelbuild/bazel#5508).

jasmine_node_test() now uses nodejs_test_macro()
instead of nodejs_test(). This changes the test's
executable from a Bash script to a native Windows
binary, so the rule can be tested using Bazel's
new Windows-native test wrapper.

The default test wrapper is a Bash script, which
could run shell scripts as subprocesses so it
could test nodejs_test() directly.

The new test wrapper is a native C++ binary that
can only run native Windows binaries. (But it does
not require Bash, see bazelbuild/bazel#5508.)

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe: Test related change

What is the current behavior?

Tests in //internal/e2e/fine_grained_deps:* fail with Bazel 0.25.0rc2 and --incompatible_windows_native_test_wrapper. (Flag info: bazelbuild/bazel#6622)

Bazel output:

C:\src\rules_nodejs> git rev-parse HEAD
593d47d8e1c77eb6fee6b5a8fe32895be1cbfb01

C:\src\rules_nodejs> c:\src\bazel-releases\0.25.0\rc2\bazel.exe test --incompatible_windows_native_test_wrapper //internal/e2e/fine_grained_deps:*
(...)
INFO: From Testing //internal/e2e/fine_grained_deps:test_npm:
==================== Test output for //internal/e2e/fine_grained_deps:test_npm:
ERROR(tools/test/windows/tw.cc:1250) value: 193 (0x000000c1): CreateProcessW failed (C:\_bazel\o375m4zz\execroot\build_bazel_rules_nodejs\bazel-out\x64_windows-fastbuild\bin\internal\e2e\fine_grained_deps\test_npm.sh)
ERROR(tools/test/windows/tw.cc:1442) Failed to start test process "C:\_bazel\o375m4zz\execroot\build_bazel_rules_nodejs\bazel-out\x64_windows-fastbuild\bin\internal\e2e\fine_grained_deps\test_npm.sh"
================================================================================

What is the new behavior?

Those tests pass now.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Fix the jasmine_node_test() rule on Windows when
tested with Bazel's Windows-native test wrapper
(see bazelbuild/bazel#5508).

jasmine_node_test now uses nodejs_test_macro, so
on Windows it depends on the sh_test (whose output
is an .exe file) and not on nodejs_test (whose
output is a .sh file). The native test wrapper
can't test nodejs_test directly because it can't
create a subprocess for an .sh file.
@laszlocsomor
Copy link
Contributor Author

I'll fix the test failures and ping this thread.

@laszlocsomor laszlocsomor changed the title Windows: jasmine_node_test uses nodejs_test_macro WIP: Windows: jasmine_node_test uses nodejs_test_macro Apr 16, 2019
Change the file npm_package.spec.js was locating,
from "test.sh" to just "test".
@laszlocsomor laszlocsomor changed the title WIP: Windows: jasmine_node_test uses nodejs_test_macro Windows: jasmine_node_test uses nodejs_test_macro Apr 16, 2019
@laszlocsomor
Copy link
Contributor Author

All fixed.

@laszlocsomor
Copy link
Contributor Author

Ping.

@kyliau kyliau merged commit b4d4bbf into bazel-contrib:master Apr 18, 2019
@alexeagle
Copy link
Collaborator

We should figure out how to remove those macros altogether. They are only there to get the native windows exe - the indirection has cost us before.

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

Successfully merging this pull request may close these issues.

4 participants