Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Issue 10584014: Change test scripts to use Path library in most places, instead of strings. (Closed)

Created:
8 years, 6 months ago by Bill Hesse
Modified:
8 years, 5 months ago
CC:
reviews_dartlang.org, sra1, Siggi Cherem (dart-lang), Bob Nystrom, ahe, Søren Gjesse, Mads Ager (google)
Visibility:
Public.

Description

Add Path library and change test scripts, combined change. Use Path for the filename and TestInformation.filename throughout test scripts. Change test_suite.dart to use Path class. Fix bug in join Address comments. Address comments Address comments on Path library. Add path library to dart:io. BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=9203

Patch Set 1 #

Patch Set 2 : rebase #

Patch Set 3 : rebase to committed Path class. #

Patch Set 4 : Upload current version, to work remotely. #

Patch Set 5 : Make further changes. #

Patch Set 6 : Take out changes to Path as separate CL. #

Total comments: 10

Patch Set 7 : Address my own comments. #

Total comments: 15

Patch Set 8 : Fix bugs #

Total comments: 26

Patch Set 9 : missing semicolon #

Unified diffs Side-by-side diffs Delta from patch set Stats (+228 lines, -263 lines) Patch
M samples/tests/dartc/test_config.dart View 1 2 3 4 2 chunks +3 lines, -1 line 0 comments Download
M tests/co19/test_config.dart View 1 2 3 4 2 chunks +2 lines, -1 line 0 comments Download
M tools/test.dart View 1 2 3 4 5 6 7 3 chunks +22 lines, -21 lines 0 comments Download
M tools/test-runtime.dart View 1 2 3 4 5 6 7 3 chunks +9 lines, -8 lines 0 comments Download
M tools/testing/dart/browser_test.dart View 1 2 3 4 5 6 7 8 2 chunks +8 lines, -24 lines 0 comments Download
M tools/testing/dart/multitest.dart View 1 2 3 4 5 9 chunks +67 lines, -68 lines 0 comments Download
M tools/testing/dart/test_runner.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tools/testing/dart/test_suite.dart View 1 2 3 4 5 6 7 8 40 chunks +116 lines, -139 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Bill Hesse
https://chromiumcodereview.appspot.com/10584014/diff/12001/tools/testing/dart/test_suite.dart File tools/testing/dart/test_suite.dart (left): https://chromiumcodereview.appspot.com/10584014/diff/12001/tools/testing/dart/test_suite.dart#oldcode362 tools/testing/dart/test_suite.dart:362: if (start > testsStart) { This branch is only ...
8 years, 6 months ago (2012-06-26 12:58:40 UTC) #1
Anton Muhin
that's huge https://chromiumcodereview.appspot.com/10584014/diff/12001/tools/testing/dart/test_suite.dart File tools/testing/dart/test_suite.dart (right): https://chromiumcodereview.appspot.com/10584014/diff/12001/tools/testing/dart/test_suite.dart#newcode196 tools/testing/dart/test_suite.dart:196: // String get filename() => '$filePath'; commented ...
8 years, 6 months ago (2012-06-26 13:22:18 UTC) #2
Emily Fortuna
lgtm, with comments. https://chromiumcodereview.appspot.com/10584014/diff/13004/tools/test-runtime.dart File tools/test-runtime.dart (right): https://chromiumcodereview.appspot.com/10584014/diff/13004/tools/test-runtime.dart#newcode85 tools/test-runtime.dart:85: final name = testSuiteDir.filename; nice! :-D ...
8 years, 6 months ago (2012-06-26 18:26:24 UTC) #3
Bill Hesse
This change uses the new Path class in most places in the core test scripts ...
8 years, 5 months ago (2012-06-27 09:35:03 UTC) #4
Anton Muhin
lgtm w/ comments addressed https://chromiumcodereview.appspot.com/10584014/diff/13004/tools/testing/dart/test_suite.dart File tools/testing/dart/test_suite.dart (right): https://chromiumcodereview.appspot.com/10584014/diff/13004/tools/testing/dart/test_suite.dart#newcode375 tools/testing/dart/test_suite.dart:375: filePath.relativeTo(suiteDir); nit: won't it fit ...
8 years, 5 months ago (2012-06-27 13:11:24 UTC) #5
Mads Ager (google)
DBC Overall this is looking a lot better than the old string manipulations! :) https://chromiumcodereview.appspot.com/10584014/diff/13004/tools/testing/dart/browser_test.dart ...
8 years, 5 months ago (2012-06-27 16:08:18 UTC) #6
Emily Fortuna
https://chromiumcodereview.appspot.com/10584014/diff/13004/tools/testing/dart/test_suite.dart File tools/testing/dart/test_suite.dart (right): https://chromiumcodereview.appspot.com/10584014/diff/13004/tools/testing/dart/test_suite.dart#newcode1281 tools/testing/dart/test_suite.dart:1281: 'ff': 1}.containsKey(runtime); On 2012/06/27 16:08:18, Mads Ager wrote: > ...
8 years, 5 months ago (2012-06-27 16:56:49 UTC) #7
Siggi Cherem (dart-lang)
very nice to see Path used here :) https://chromiumcodereview.appspot.com/10584014/diff/13004/tools/testing/dart/test_suite.dart File tools/testing/dart/test_suite.dart (right): https://chromiumcodereview.appspot.com/10584014/diff/13004/tools/testing/dart/test_suite.dart#newcode602 tools/testing/dart/test_suite.dart:602: String ...
8 years, 5 months ago (2012-06-27 17:19:03 UTC) #8
Bill Hesse
8 years, 5 months ago (2012-06-28 15:31:22 UTC) #9
Strangely, I can't get a failure to happen with the broken version of this line:

tools/testing/dart/test_suite.dart:602: String compiledName =
namePath.filenameWithoutExtension;
On 2012/06/27 17:19:03, sigmund wrote:
> missing .js extension:
> => '${namePath.filenameWithoutExtension}.js'
, which is only on browser tests with // OtherScripts lines.

http://codereview.chromium.org/10584014/diff/13004/tools/testing/dart/browser...
File tools/testing/dart/browser_test.dart (right):

http://codereview.chromium.org/10584014/diff/13004/tools/testing/dart/browser...
tools/testing/dart/browser_test.dart:41:
#import('${dartHome.append('lib/unittest/html_config.dart')}', prefix:
'config');
Okay, broke the #import statement to span multiple lines - the spec says that is
OK.

On 2012/06/27 16:08:18, Mads Ager wrote:
> Long line.

http://codereview.chromium.org/10584014/diff/13004/tools/testing/dart/multite...
File tools/testing/dart/multitest.dart (right):

http://codereview.chromium.org/10584014/diff/13004/tools/testing/dart/multite...
tools/testing/dart/multitest.dart:104: "Invalid test directive '$nextOutcome' on
line ${lineCount}:\n"
On 2012/06/27 16:08:18, Mads Ager wrote:
> Is the addition of a newline character on purpose here?

Yes.  If it can't fit on a line in the source, why not make sure it doesn't wrap
confusingly when printed?  I think there is no need to make this error message a
single line.

http://codereview.chromium.org/10584014/diff/13004/tools/testing/dart/test_su...
File tools/testing/dart/test_suite.dart (right):

http://codereview.chromium.org/10584014/diff/13004/tools/testing/dart/test_su...
tools/testing/dart/test_suite.dart:375: filePath.relativeTo(suiteDir);
On 2012/06/27 13:11:24, antonmuhin wrote:
> nit: won't it fit a single line?

Done.

http://codereview.chromium.org/10584014/diff/13004/tools/testing/dart/test_su...
tools/testing/dart/test_suite.dart:602: String compiledName =
namePath.filenameWithoutExtension;
On 2012/06/27 17:19:03, sigmund wrote:
> missing .js extension:
> => '${namePath.filenameWithoutExtension}.js'

Done.

http://codereview.chromium.org/10584014/diff/13004/tools/testing/dart/test_su...
tools/testing/dart/test_suite.dart:696: testUniqueName =
testUniqueName.substring(0, testUniqueName.length - 5);
On 2012/06/27 16:08:18, Mads Ager wrote:
> On 2012/06/27 13:11:24, antonmuhin wrote:
> > isn't that to fetch the path w/o extension?  if yes, do not we have better
> > methods in Path class?
> 
> Something like:
> 
> path = path.directoryPath.append(path.filenameWithoutExtension);
> 
> should do it and be easier to read. :)

Done.

http://codereview.chromium.org/10584014/diff/13004/tools/testing/dart/test_su...
tools/testing/dart/test_suite.dart:749: String get dumpRenderTreeFilename() {
On 2012/06/27 16:08:18, Mads Ager wrote:
> Should we make these return Path objects and wait with the toNativePath call
> until we actually need to have the native path?

Considering that one of the sources of the value is a String already, and that
this change would just put the toNativePath in multiple places, instead of one,
I didn't do it.  I didn't think we needed to refactor and use Path in every
possible place, just the places it helped, or would clean up code for future
changes.

http://codereview.chromium.org/10584014/diff/13004/tools/testing/dart/test_su...
tools/testing/dart/test_suite.dart:810: args.add('$filePath');
Yes.
On 2012/06/27 17:19:03, sigmund wrote:
> Not sure, but should this be toNativePath?

http://codereview.chromium.org/10584014/diff/13004/tools/testing/dart/test_su...
tools/testing/dart/test_suite.dart:1250: File scriptF = new File(new
Options().script);
On 2012/06/27 16:08:18, Mads Ager wrote:
> Spell out File and Path?
> 
> This is so much nicer than the old version! :)

Done.

http://codereview.chromium.org/10584014/diff/13004/tools/testing/dart/test_su...
tools/testing/dart/test_suite.dart:1281: 'ff': 1}.containsKey(runtime);
OK, changed back, but using indexOf, instead of .some().

On 2012/06/27 16:56:49, Emily Fortuna wrote:
> On 2012/06/27 16:08:18, Mads Ager wrote:
> > On 2012/06/27 09:35:03, Bill Hesse wrote:
> > > It was a list, using contains, but that doesn't take advantage of hashing.

> I
> > > just think there should be an example of how to make a constant lookup
> table,
> > > since there is no such thing as a constant Set or HashSet.  This
illustrates
> a
> > > missing feature of the language, and how to solve it.
> > 
> > I agree with Emily. I think the code in test.dart should be as simple as
> > possible. Using a map here does not seem like the simplest thing and
> performance
> > is definitely not an issue here.
> > 
> > > On 2012/06/26 18:26:24, Emily Fortuna wrote:
> > > > Why make this a map here? How about:
> > > > 
> > > > static bool isBrowserRuntime(String runtime) =>
> > > >      const <String>['drt', 'dartium', 'ie', 'safari', 'opera', 'chrome',
> > > > 'ff'].indexOf(runtime) > -1;
> > > > 
> > > > or similar
> > > 
> > 
> 
> Yeah, for the sake of readability and clarity, I prefer a list, even if it is
> slightly less performant. I doubt any bottlenecks that develop would be here.

Powered by Google App Engine
This is Rietveld 408576698