<commit_before>#!/usr/bin/env dart_bin
// Copyright (c) 2011, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

#library("test");

#import("testing/dart/test_runner.dart");
#import("testing/dart/test_options.dart");

#import("../tests/standalone/test_config.dart");
#import("../tests/corelib/test_config.dart");


// TODO(ager): This activity tracking is temporary until stdout is
// closed implicitly when nothing more can happen.
int pendingActivities = 0;

void onExit() {
  stdout.write('\n'.charCodes());
  stdout.close();
}

void activityStarted() {
  pendingActivities++;
}

void activityCompleted() {
  if (--pendingActivities == 0) onExit();
}

main() {
  var optionsParser = new TestOptionsParser();
  var configurations = optionsParser.parse(new Options().arguments);
  if (configurations == null) return;
  activityStarted();
  var queue = new ProcessQueue(configurations[0], activityCompleted);
  for (var conf in configurations) {
    activityStarted();
    new StandaloneTestSuite(conf).forEachTest(queue.runTest, activityCompleted);
    activityStarted();
    new CorelibTestSuite(conf).forEachTest(queue.runTest, activityCompleted);
  }
}
<commit_msg>Fix activity tracking in test scripts.<commit_after>#!/usr/bin/env dart_bin
// Copyright (c) 2011, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

#library("test");

#import("testing/dart/test_runner.dart");
#import("testing/dart/test_options.dart");

#import("../tests/standalone/test_config.dart");
#import("../tests/corelib/test_config.dart");

// TODO(ager): This activity tracking is temporary until stdout is
// closed implicitly when nothing more can happen.
int pendingActivities = 0;

void activityStarted() {
  ++pendingActivities;
}

void activityCompleted() {
  --pendingActivities;
}

void exitIfLastActivity() {
  if (pendingActivities == 1) {
    stdout.write('\n'.charCodes());
    stdout.close();
  }
}

main() {
  var optionsParser = new TestOptionsParser();
  var configurations = optionsParser.parse(new Options().arguments);
  if (configurations == null) return;
  activityStarted();
  var queue = new ProcessQueue(configurations[0], exitIfLastActivity);
  for (var conf in configurations) {
    activityStarted();
    new StandaloneTestSuite(conf).forEachTest(queue.runTest, activityCompleted);
    activityStarted();
    new CorelibTestSuite(conf).forEachTest(queue.runTest, activityCompleted);
  }
}

{'fraction_non_alphanumeric': 0.13087248322147652, 'fraction_numerical': 0.005219985085756898, 'mean_word_length': 4.757510729613734, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3776850', 'n_tokens_mistral': 803, 'n_tokens_neox': 781, 'n_words': 219}