Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(294)

Issue 4639101: code review 4639101: json: fix test if rand returns 0. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 8 months ago by iant
Modified:
13 years, 8 months ago
Reviewers:
iant2, rsc
CC:
golang-dev, gri
Visibility:
Public.

Description

json: fix test if rand returns 0. Fixes test when run with gccgo using optimization, which changes the order of the calls to rand.

Patch Set 1 #

Total comments: 1

Patch Set 2 : diff -r 743cfe1095ed https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -1 line) Patch
M src/pkg/json/scanner_test.go View 1 1 chunk +4 lines, -1 line 0 comments Download

Messages

Total messages: 8
iant
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 8 months ago (2011-07-06 18:35:43 UTC) #1
gri
LGTM
13 years, 8 months ago (2011-07-06 18:41:08 UTC) #2
gri
FYI http://codereview.appspot.com/4639101/diff/1/src/pkg/json/scanner_test.go File src/pkg/json/scanner_test.go (right): http://codereview.appspot.com/4639101/diff/1/src/pkg/json/scanner_test.go#newcode258 src/pkg/json/scanner_test.go:258: x := make([]interface{}, int(f)) s/int(f)/f/
13 years, 8 months ago (2011-07-06 18:42:26 UTC) #3
iant
*** Submitted as http://code.google.com/p/go/source/detail?r=332835d5b61e *** json: fix test if rand returns 0. Fixes test when ...
13 years, 8 months ago (2011-07-06 20:01:02 UTC) #4
rsc
> Fixes test when run with gccgo using optimization, which > changes the order of ...
13 years, 8 months ago (2011-07-11 06:34:51 UTC) #5
iant2
Russ Cox <rsc@golang.org> writes: >> Fixes test when run with gccgo using optimization, which >> ...
13 years, 8 months ago (2011-07-11 16:54:14 UTC) #6
rsc
> This is not completely proven, but it seemed plausible enough for me to > ...
13 years, 8 months ago (2011-07-11 17:38:00 UTC) #7
iant2
13 years, 8 months ago (2011-07-13 01:07:42 UTC) #8
Russ Cox <rsc@golang.org> writes:

>> This is not completely proven, but it seemed plausible enough for me to
>> fix the code which looked wrong anyhow.  I think it's the overall order
>> in which the test functions are run that is different, not the specific
>> calls to rand.  The order of the tests doesn't matter, except to the
>> extent that it changes the calls to rand, and thus wound up with a zero
>> when it previously got a non-zero value.
>
> For what it's worth, the intent for gotest is to run all the tests
> in the order in the file, so that if you put simple tests first
> they get run first.
>
> The order across files is not specified, but the only uses
> of rand are in scanner_test.go.

Yeah, I've noticed that in the past.  I patched the gccgo testsuite to
use gcc's -fno-toplevel-reorder option to emit functions in the order in
which they appear in the source file.

Ian
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b