forked from bazel-contrib/rules_nodejs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for $(location) in nodejs_binary#entry_point
Fixes bazel-contrib#32
- Loading branch information
Showing
9 changed files
with
106 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""End-to-end test for a nodejs_binary | ||
Simply find the binary and run it, asserting that it produces correct output. | ||
""" | ||
|
||
from subprocess import check_output | ||
from sys import platform | ||
import unittest | ||
|
||
from build_bazel_rules_nodejs.internal.runfiles import resolve_runfile | ||
|
||
class BinTest(unittest.TestCase): | ||
|
||
def testRuns(self): | ||
if platform == "win32" or platform == "win64": | ||
program = 'program_example/bin.exe' | ||
else: | ||
program = 'program_example/bin' | ||
actual = check_output([resolve_runfile(program)]) | ||
self.assertEqual(actual, '2\n') | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import os | ||
|
||
def resolve_runfile(path): | ||
if os.getenv('RUNFILES_MANIFEST_ONLY') != "1": | ||
return os.path.join(os.environ['TEST_SRCDIR'], path) | ||
|
||
manifest = os.getenv('RUNFILES_MANIFEST_FILE') | ||
with open(manifest) as f: | ||
for line in f.readlines(): | ||
if line.split()[0] == path: | ||
return line.split()[1] | ||
raise "Cannot find %s in manifest %s" % (path, manifest) |