Skip to content

Commit

Permalink
Make codegen_test more self contained
Browse files Browse the repository at this point in the history
Addressed codegen_test `TODO(jmesserly): it'd be nice to do all cleanup
here …`.
  • Loading branch information
chalin committed Mar 26, 2015
1 parent 48e3342 commit f73b4ec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
14 changes: 7 additions & 7 deletions pkg/dev_compiler/test/codegen_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ main(arguments) {
}
var realSdk = getSdkDir(arguments).path;

// Validate that old output is gone before running.
// TODO(jmesserly): it'd be nice to do all cleanup here, including removing
// pub's 'packages' symlinks which mess up the diff. That way this test
// can be self contained instead of depending on a shell script.
if (new Directory(actualDir).existsSync()) {
throw 'Old compiler output should be cleaned up first. Use ./test/test.sh';
}
// Remove old output, and `packages` symlinks which mess up the diff.
var dir = new Directory(actualDir);
if (dir.existsSync()) dir.deleteSync(recursive: true);
var packagesDirs = new Directory(inputDir)
.listSync(recursive: true)
.where((d) => d is Directory && path.basename(d.path) == 'packages');
packagesDirs.forEach((d) => d.deleteSync());

for (var filePath in paths) {
var filename = path.basenameWithoutExtension(filePath);
Expand Down
5 changes: 0 additions & 5 deletions pkg/dev_compiler/test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ cd $TEST_DIR/..

./tool/build_sdk.sh

# Remove packages symlinks, and old codegen output
find test/codegen -name packages -exec rm {} \;
rm -r test/codegen/actual 2> /dev/null || true
find test/dart_codegen -name packages -exec rm {} \;
rm -r test/dart_codegen/actual 2> /dev/null || true
dart -c test/all_tests.dart || fail

# validate codegen_test output
Expand Down
2 changes: 1 addition & 1 deletion pkg/dev_compiler/tool/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
set -e

function clean {
# This is a much more simple clean script, assuming git is available
# This is a much simpler clean script, assuming git is available
pushd test
git clean -fdx
popd
Expand Down

0 comments on commit f73b4ec

Please sign in to comment.