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

Instrument issue #8

Closed
panghl opened this issue Oct 31, 2012 · 7 comments
Closed

Instrument issue #8

panghl opened this issue Oct 31, 2012 · 7 comments
Assignees

Comments

@panghl
Copy link

panghl commented Oct 31, 2012

Hi,

Use the new build to instrument code, find some issue after instrumented code:
before :
var Count = base + Math.round( (Math.random() - 0.5) * base / 5);
after:
var Count = base + Math.round((Math.random() - 0x0.5) * base / 0x5);

also:
supported = {'a':3.0,'b:7,'c':4,'d':2};
supported= {'a': 0x3.0, 'b': 0x7, 'c': 0x4, 'd': 0x2};

There has some error with instrument decimals, please help check on it.

Thanks in advance!

@tntim96
Copy link
Owner

tntim96 commented Oct 31, 2012

Strange - I might need more information. Feeding in:

var Count = base + Math.round( (Math.random() - 0.5) * base / 5);
supported = {'a':3.0,'b':7,'c':4,'d':2};

...I get the following out

//Header code
_$jscoverage['/target/bug.js'][1]++;
var Count = base + Math.round((Math.random() - 0.5) * base / 5);
_$jscoverage['/target/bug.js'][2]++;
supported = {'a': 3.0, 'b': 7, 'c': 4, 'd': 2};

@panghl
Copy link
Author

panghl commented Nov 2, 2012

Got the error info with the following code:

(function(testjs){
testjs = {
test: function(){
if (nValue < 0xf0000000)
Record = nValue;
else
Record = (nValue - 0xf0000000);}
};

supported = {'a': 3.0, 'b': 7, 'c': 4, 'd': 2};

})(testjs);

Another thing, does the JSCover suport option "--verbose"? Sometime it will help user on quick find the issue file or line.

@tntim96
Copy link
Owner

tntim96 commented Nov 2, 2012

Thanks - I can now reproduce the error. It's most likely an issue with Rhino, my patch or both. I'll start investigating.

does the JSCover suport option "--verbose"

No, however any errors during instrumentation are logged to errors.log in the report directory.

@tntim96
Copy link
Owner

tntim96 commented Nov 5, 2012

I've patched Rhino, please try version 0.0.9

Rhino details are here https://bugzilla.mozilla.org/show_bug.cgi?id=800616

@tntim96 tntim96 closed this as completed Nov 5, 2012
@panghl
Copy link
Author

panghl commented Nov 6, 2012

Hi,
Tried version 0.0.9, when instrument code, there has some error tips in console:

Exception in thread "main" org.mozilla.javascript.EvaluatorException: syntax err
or
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultError
Reporter.java:77)
at org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporte
r.java:64)
at org.mozilla.javascript.Parser.addError(Parser.java:188)
at org.mozilla.javascript.Parser.addError(Parser.java:166)
at org.mozilla.javascript.Parser.reportError(Parser.java:223)
at org.mozilla.javascript.Parser.reportError(Parser.java:210)
at org.mozilla.javascript.Parser.reportError(Parser.java:203)
at org.mozilla.javascript.Parser.primaryExpr(Parser.java:2843)
at org.mozilla.javascript.Parser.memberExpr(Parser.java:2418)
at org.mozilla.javascript.Parser.unaryExpr(Parser.java:2316)
at org.mozilla.javascript.Parser.mulExpr(Parser.java:2241)
at org.mozilla.javascript.Parser.addExpr(Parser.java:2225)
at org.mozilla.javascript.Parser.shiftExpr(Parser.java:2206)
at org.mozilla.javascript.Parser.relExpr(Parser.java:2181)
at org.mozilla.javascript.Parser.eqExpr(Parser.java:2153)
at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:2142)
at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:2131)
at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:2120)
at org.mozilla.javascript.Parser.andExpr(Parser.java:2109)
at org.mozilla.javascript.Parser.orExpr(Parser.java:2098)
at org.mozilla.javascript.Parser.condExpr(Parser.java:2062)
at org.mozilla.javascript.Parser.assignExpr(Parser.java:2033)
at org.mozilla.javascript.Parser.expr(Parser.java:2012)
at org.mozilla.javascript.Parser.statementHelper(Parser.java:1039)
at org.mozilla.javascript.Parser.statement(Parser.java:901)
at org.mozilla.javascript.Parser.parse(Parser.java:540)
at org.mozilla.javascript.Parser.parse(Parser.java:502)
at jscover.instrument.SourceProcessor.instrumentSource(SourceProcessor.j
ava:411)
at jscover.instrument.SourceProcessor.processSourceWithoutHeader(SourceP
rocessor.java:395)
at jscover.instrument.SourceProcessor.processSource(SourceProcessor.java
:387)
at jscover.instrument.SourceProcessor.processSourceForFileSystem(SourceP
rocessor.java:382)
at jscover.instrument.InstrumenterService.instrumentJSForFileSystem(Inst
rumenterService.java:376)
at jscover.filesystem.FileSystemInstrumenter.copyFolder(FileSystemInstru
menter.java:386)
at jscover.filesystem.FileSystemInstrumenter.copyFolder(FileSystemInstru
menter.java:382)
at jscover.filesystem.FileSystemInstrumenter.copyFolder(FileSystemInstru
menter.java:382)
at jscover.filesystem.FileSystemInstrumenter.copyFolder(FileSystemInstru
menter.java:382)
at jscover.filesystem.FileSystemInstrumenter.run(FileSystemInstrumenter.
java:367)
at jscover.Main.runFileSystem(Main.java:445)
at jscover.Main.runMain(Main.java:417)
at jscover.Main.main(Main.java:406)

What's the matter? Please help me to locate the issue. Thanks.

@tntim96
Copy link
Owner

tntim96 commented Nov 6, 2012

Can you confirm if your hexadecimal issue is solved?

Tried version 0.0.9, when instrument code, there has some error tips in console

This looks like a separate error. Can you open a new issue? In the meantime, this looks like Rhino is unable to parse your JavaScript. Check your JavaScript language level matches your source (see the --js-version option in the manual). If you are still having no luck ,you'll have to try your code in smaller chunks to isolate the issue. If you can isolate the relevant code, please post it and I'll try to fix or log a bug with Rhino it's genuine.

@panghl
Copy link
Author

panghl commented Nov 6, 2012

The hexadecimal issue is solved with build 0.0.9.
Later I'll open a new issue about instrument error.

Thanks

@ghost ghost assigned tntim96 Nov 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants