Skip to content

test: add the ability to run the tests from node in the path #9674

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
wants to merge 1 commit into from

Conversation

gdams
Copy link
Member

@gdams gdams commented Nov 18, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

test

Description of change

This pr adds the ability to run tools/test.py --path. This means that instead of defaulting to out/Release we can use the node version from the path.

@nodejs-github-bot nodejs-github-bot added the tools Issues and PRs related to the tools directory. label Nov 18, 2016
@jasnell
Copy link
Member

jasnell commented Nov 18, 2016

hmmm.. LGTM I suppose. @nodejs/build

@mscdex mscdex added the test Issues and PRs related to the tests. label Nov 18, 2016
@gibfahn
Copy link
Member

gibfahn commented Nov 18, 2016

Copy link
Member

@gibfahn gibfahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this would definitely be useful for manually running tests.

@MylesBorins
Copy link
Contributor

@GeorgeAdams95 what would be the purpose of this? It would seem odd to me to run tests that are different than the tests shipped with a particular binary

@gdams
Copy link
Member Author

gdams commented Nov 21, 2016

@thealphanerd this would be useful for manually re-running tests, means that rather than having to build node you could just use nvm for example

@gibfahn
Copy link
Member

gibfahn commented Jan 3, 2017

This pr adds the ability to run `tools/test.py --path`. This means that
instead of defaulting to out/Release we can use the node version from
the path.
@gibfahn
Copy link
Member

gibfahn commented Jan 3, 2017

@gibfahn
Copy link
Member

gibfahn commented Jan 3, 2017

CI is green, any objections to this?

@gibfahn gibfahn self-assigned this Jan 3, 2017
@jasnell
Copy link
Member

jasnell commented Jan 3, 2017

No objections

gibfahn pushed a commit that referenced this pull request Jan 4, 2017
This pr adds the ability to run `tools/test.py --path`. This means that
instead of defaulting to out/Release we can use the node version from
the path.

PR-URL: #9674
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@gibfahn
Copy link
Member

gibfahn commented Jan 4, 2017

Landed in 4198253

@evanlucas
Copy link
Contributor

Added don't land on v7.x for now. I keep getting errors when running tests now:

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "tools/test.py", line 141, in RunSingle
    output = case.Run()
  File "/Users/evan/dev/code/forks/WORK-node/tools/test.py", line 505, in Run
    result = self.RunCommand(self.GetCommand(), {
  File "/Users/evan/dev/code/forks/WORK-node/test/abort/../testpy/__init__.py", line 60, in GetCommand
    result = [self.config.context.GetVm(self.arch, self.mode)]
  File "tools/test.py", line 871, in GetVm
    if not ProcessOptions(options):
  File "tools/test.py", line 1429, in ProcessOptions
    options.j = int(cores) if cores is not None else multiprocessing.cpu_count()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/__init__.py", line 136, in cpu_count
    raise NotImplementedError('cannot determine number of cpus')
NotImplementedError: cannot determine number of cpus

We should probably revert until those can be addressed.

@thefourtheye
Copy link
Contributor

Something like this, could fix the problem I think.

# Pastebin 2d5uLHb4
diff --git a/tools/test.py b/tools/test.py
index 18188e7b00..f553122ad5 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -852,7 +852,7 @@ class Context(object):

   def __init__(self, workspace, buildspace, verbose, vm, args, expect_fail,
                timeout, processor, suppress_dialogs,
-               store_unexpected_output, repeat):
+               store_unexpected_output, repeat, path):
     self.workspace = workspace
     self.buildspace = buildspace
     self.verbose = verbose
@@ -864,16 +864,11 @@ class Context(object):
     self.suppress_dialogs = suppress_dialogs
     self.store_unexpected_output = store_unexpected_output
     self.repeat = repeat
+    self.path = path

   def GetVm(self, arch, mode):
-    parser = BuildOptions()
-    (options, args) = parser.parse_args()
-    if not ProcessOptions(options):
-      parser.print_help()
-      return 1
-    if options.path:
-      name = find_executable("node")
-      return name
+    if self.path:
+      return find_executable("node")
     if arch == 'none':
       name = 'out/Debug/node' if mode == 'debug' else 'out/Release/node'
     else:
@@ -1577,7 +1572,8 @@ def Main():
                     processor,
                     options.suppress_dialogs,
                     options.store_unexpected_output,
-                    options.repeat)
+                    options.repeat,
+                    options.path)

@gibfahn
Copy link
Member

gibfahn commented Jan 4, 2017

Okay, so this happens when using -J with a large number of tests, and it didn't show up with CI because we don't use -J (we use -j and work out the number of cores ourselves).

Sorry for missing this in the review!

italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
This pr adds the ability to run `tools/test.py --path`. This means that
instead of defaulting to out/Release we can use the node version from
the path.

PR-URL: nodejs#9674
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants