Skip to content
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

Library bytecode verification unittests #1505

Closed
wants to merge 1 commit into from

Conversation

tcare
Copy link
Contributor

@tcare tcare commented Aug 27, 2016

Reintroduces bytecode verification unittests for library code. We previously had this check in SD days, but it was complicated and called external scripts to work. The new version uses just RL to compare against the header file directly. A number of changes had to be made:

  • Removed non-standard %REGRESS% psuedo environment variable. Instead, test files and baselines are relative paths based on the directory containing the rlexe.xml.
  • Fixed the relative path behavior of runtests.py. Also added a guard to the timezone set so runtests.py works on Windows again.
  • Fixed an issue where ch would generate different bytecode than jshost due to an implicit fscrNoAsmJs parser flag in ScriptContext. We don't need this flag on the initial entry, so it can be removed from the JSRT entrypoint for library bytecode generation.
  • Disabled using the release version for serialized library bytecode, instead using a fixed version (all 0's). This is OK as long as we check the bytecode integrity in unit tests.
  • Added an implicit disable_jit tag exclusion when not running disable JIT; this allows us to run some test only under disable JIT and not normally.
  • Added a new bytecode directory with the xml for the tests.

Due to the changes to serialization all of the library bytecode headers needed to be changed.

@tcare
Copy link
Contributor Author

tcare commented Aug 27, 2016

V1.value = 0;
V2.value = 0;
V3.value = 0;
V4.value = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

For releases, we need to make sure we have the GUIDs in the ByteCode so that ReleaseVersioningScheme can be applied. In that scenario, can we also ensure consistent bytecode between Chakra and ChakraCore.dll

Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, I understand now. For library code, we don't want to do the GUID check? We still need to make sure the ByteCode is updated when it is supposed to be. How else can we specifically test this?


In reply to: 76506572 [](ancestors = 76506572)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the library code it doesn't really matter, as long as the unit tests catch the incorrectness. We usually catch this in unit tests when we fail unit tests, but we don't always catch them right now. E.g. the jshost/ch inconsistency fixed in this change. The unit tests are guaranteed to catch the bytecode changes.

@dilijev
Copy link
Contributor

dilijev commented Aug 27, 2016

//-------------------------------------------------------------------------------------------------------

Remove this file?


Refers to: test/out:1 in bdf71d1. [](commit_id = bdf71d1, deletion_comment = False)

@tcare
Copy link
Contributor Author

tcare commented Aug 27, 2016

Oops thanks for the catch.

<test>
<default>
<tags>exclude_dynapogo,exclude_amd64,exclude_arm,require_backend</tags>
<compile-flags>-GenerateLibraryByteCodeHeader</compile-flags>
Copy link
Contributor

Choose a reason for hiding this comment

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

-GenerateLibraryByteCodeHeader [](start = 6, length = 61)

So the plan is to use a test to generate the entire bytecode and check for differences, and then alert the user to the fact that the bytecode needs to be updated?

Since we've already got the binaries handy, this is a good approach.

I think right now the way we regen bytecode depends on scripts. Since we're talking about eventually replacing rl.exe anyway, I don't want to suggest that we put that functionality into rl.exe, but we should define a unified way to generate bytecode.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We used to use scripts in SD but never ported it over to git. There essentially doesn't need to be a script; it was doing what RL does. The only real change is that instead of writing to a file I write to stdout.

@tcare
Copy link
Contributor Author

tcare commented Aug 27, 2016

Looks like Jenkins is having trouble with release and crossplat. I'll investigate next week.

@dilijev
Copy link
Contributor

dilijev commented Aug 27, 2016

@tcare
PreFAST warnings from release builds on Windows.
testrunner.py doesn't support %VAR% syntax so it can't interpret the test definitions.

<default>
<tags>exclude_dynapogo,exclude_amd64,exclude_arm,require_backend</tags>
<compile-flags>-GenerateLibraryByteCodeHeader</compile-flags>
<files>%REGRESS%\..\lib\Runtime\Library\InJavascript\Intl.js</files>
Copy link
Contributor

@dilijev dilijev Aug 27, 2016

Choose a reason for hiding this comment

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

%REGRESS% [](start = 13, length = 9)

I think paths are relative to the test location so you can just use ..\..\lib\

Copy link
Contributor Author

@tcare tcare Aug 27, 2016

Choose a reason for hiding this comment

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

This doesn't work for using jshost to test core with existing scripts. I'll see if I can work around it..

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point. Simplest solution is to make testrunner.py support %VAR%

@tcare
Copy link
Contributor Author

tcare commented Aug 29, 2016

Closing for now until cross plat is resolved.

@tcare tcare closed this Aug 29, 2016
@dilijev
Copy link
Contributor

dilijev commented Aug 29, 2016

@tcare Why not keep it open to track it (do we think this will take a long time to resolve?)

@tcare
Copy link
Contributor Author

tcare commented Aug 29, 2016

It'll be considerably different. I want to move away from %REGRESS%. Ideally I would move away from RL too ;)

Reintroduces bytecode verification unittests for library code. We previously had this check in SD days, but it was complicated and called external scripts to work. The new version uses just RL to compare against the header file directly. A number of changes had to be made:

- Removed non-standard %REGRESS% psuedo environment variable. Instead, test files and baselines are relative paths based on the directory containing the rlexe.xml.
- Fixed the relative path behavior of runtests.py. Also added a guard to the timezone set so runtests.py works on Windows again.
- Fixed an issue where ch would generate different bytecode than jshost due to an implicit fscrNoAsmJs parser flag in ScriptContext. We don't need this flag on the initial entry, so it can be removed from the JSRT entrypoint for library bytecode generation.
- Disabled using the release version for serialized library bytecode, instead using a fixed version (all 0's). This is OK as long as we check the bytecode integrity in unit tests.
- Added an implicit disable_jit tag exclusion when not running disable JIT; this allows us to run some test only under disable JIT and not normally.
- Added a new bytecode directory with the xml for the tests.

Due to the changes to serialization all of the library bytecode headers needed to be changed.
@tcare
Copy link
Contributor Author

tcare commented Aug 30, 2016

Reopened.

%REGRESS% is gone. We now use the test folder as the working path.

@jianchun can you please review the runtests.py changes?

@tcare
Copy link
Contributor Author

tcare commented Aug 30, 2016

Looks like runtests.py needs more work. Unfortunately we don't have a good buddy build mechanism for Jenkins at the moment. I'll ping back when I update.

@tcare
Copy link
Contributor Author

tcare commented Aug 31, 2016

Moving out serialization work to #1520

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

Successfully merging this pull request may close these issues.

None yet

3 participants