-
Notifications
You must be signed in to change notification settings - Fork 1.2k
cross platform: python script to run test files [suggestion] #951
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
Conversation
@dilijev I guess Copyright check fails because of py file? |
@dilijev I've updated netci.groovy to use runtests.py instead of runtests.sh (which is no longer exist) but somehow CI doesn't take this change into consideration? |
@obastemur Yes, changes to the CI script need to be merged in to the branch and then the tasks need to be regenerated before the CI will use them. netci.groovy is not used during the CI checks, it is only used to generate them. (That's part of why changes to the CI are so difficult to test.) Probably the fastest thing to do for now is to have runtests.sh wrap runtests.py. |
@obastemur as for the copyright failure, yes, you can see in the logs:
|
@@ -42,6 +42,7 @@ install_manifest.txt | |||
*.xcworkspace | |||
|
|||
# additional *nix generated files | |||
/ch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why /ch
instead of just ch
? Doesn't the leading slash only exclude the file if it is in the same directory as the .gitignore
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's my intention. new build script creates a symbolic link for ch on the root. I want it to be ignored on git.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be more general, we could ignore that file in any directory it happens to appear by simply removing the leading /
and send an empty config to delete Do we have to do this? BTW; Where do we update that Copyright Check algorithm to cover py files ? |
@@ -0,0 +1,120 @@ | |||
#!/usr/bin/env python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I figured this would come up. Files that need shebangs will break the copyright check. This is arguably a bug in the copyright check that needs a special case. Previously I had specified that the copyright notice had to be the VERY FIRST thing in the file. But since semantically, the shebang needs to come first when it is present, I'll add an exception.
@digitalinfinity does this exception seem reasonable?
@obastemur Why do you want to delete Anyway changes to the CI script should be done as separate pull requests (and in a separate branch, as you've noted, to avoid disruption while we sort out the details). |
The copyright check files are: The fix to ignore a shebang line at the beginning of the file will be in |
Both are executable scripts, I don't see any reason to keep both.
Great. Gonna cherry-pick this to separate branch and let's see what's going to happen |
|
||
result=$? | ||
if [[ $result == 0 && ! -f ../ch ]]; then | ||
ln -s BuildLinux/ch ../ch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you did this change to save some typing while testing manually? I tried it out and this broke my personal settings. I have "." at head of PATH. When I build at repo root and run "ch", it prints
dlopen() failed; dlerror says 'ch: cannot open shared object file: No such file or directory'
The same happens if I have <repo>/BuildLinux
at head of PATH.
My workaround was a wrapper script "ch" in my PATH to invoke BuildLinux/ch. That doesn't have this problem.
So maybe a top-level symbolic link to "ch" isn't very useful?
- It has above problem. (maybe we can investigate and fix it.)
- The primary binary is "chakracore", not "ch". "ch" is mostly a testing binary. A top-level link feels over kill for it.
- We might consider build type subdirs like BuildLinux/x64_debug, BuildLinux/x64_release. Top-level ch link doesn't work with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the above concerns. It's fairly straightforward to know where the test binary is. Especially as long as this is intended to use with already-written test code, saving typing is a moot point. For manual testing, there's not that much extra typing to do, and a wrapper script might be more useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it out and this broke my personal settings. I have "." at head of PATH. When I build at repo root and run "ch", it prints
local one is available at ./ch
I agree with the above concerns. It's fairly straightforward to know where the test binary is.
you can call ls -l ch
We might consider build type subdirs like BuildLinux/x64_debug,
We could have ch_d
or ch_debug
etc..
Especially as long as this is intended to use with already-written test code, saving typing is a moot point.
Sorry, didnt' understand. Could you please explain more?
@jianchun Although I don't expect any problem from this PR, I'm still +1 on cherry-picking this PR to separate branch and run through CI first. However, I'm also okay if you don't see any reason for that too J |
@obastemur I still strongly oppose modifying |
@@ -42,6 +42,8 @@ def report_incorrect(file_name, pairs): | |||
linecount = 0 | |||
pairs = [] | |||
with open(file_name, 'r') as sourcefile: | |||
if not re.match(r'#!/usr/bin/env.*', sourcefile.readline(), 0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just sourcefile.readline().startswith("#!")
? I think we're imposing too much structure on the shebang.
CI related file changes are removed from the PR. I guess that's all ? |
# Eventual test running harness on *nix for ChakraCore | ||
# Today, it's simply there to make sure hello.js doesn't regress | ||
# | ||
# REMOVE THIS AFTER MERGING runtests.py in! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's any need for this comment. We can make this decision later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK the decision is done. Is there any technical
reason to keep this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that, since netci.groovy
is much slower to update and the way we run the tests could change, I'm ultimately trying to reduce resistance to changes by keeping this file as a wrapper for whatever mechanism we actually use to run tests. I think that's a fair enough technical reason (based on a technical limitation of the netci.groovy
task generation mechanism).
I'm not aware of any decision regarding netci.groovy
task changes or this file in particular. I'll start an email thread with @curtisman to sort out the details.
Unless you include an exception to not return a failure error code for now, the linux tasks will keep failing until clang 3.8 is installed on the build machines, which should happen later today. Since that change is incoming, it's probably best to wait until it is done and then re-run the tests before merging this in. |
This PR - adds a Python based test script to run all the test files or the ones from a given folder. In addition to executing JS files, it also compares the results to predefined baseline files. - adds a shebang support for copyright check - replaces runtests.sh on CI/linux Try; ''' ./build.sh ./test/runtests.py Basics ''' In order to run a single file ''' ./test/runtests.py Basics/hello.js '''
@dotnet-bot test Copyright Check please |
Following completion of the Copyright Check, LGTM and this is good to merge. |
Since the toolchain has been updated... |
…ion] Merge pull request #951 from obastemur:testing This PR - adds a Python based test script to run all the test files or the ones from a given folder. In addition to executing JS files, it also compares the results to predefined baseline files. - replaces the functionality of `runtests.sh` to call `runtests.py` Try: ``` ./build.sh ./test/runtests.py Basics ``` In order to run a single file ``` ./test/runtests.py Basics/hello.js ```
This PR
a given folder. In addition to executing JS files, it also compares the results
to predefined baseline files.
runtests.sh
to callruntests.py
Try:
In order to run a single file