about summary refs log tree commit diff
path: root/src/tools/rustdoc-gui/tester.js
diff options
context:
space:
mode:
authorStefan Schindler <dns2utf8@estada.ch>2021-08-14 23:19:28 +0200
committerStefan Schindler <dns2utf8@estada.ch>2021-08-14 23:19:28 +0200
commit86fa21cda57b7235e191926012ffa6e3b534e92b (patch)
tree5f1a80ae81b05632ac7648884061f73d036d9eb5 /src/tools/rustdoc-gui/tester.js
parentc17628be18b1c99b1cb4c78b28670068da0f2fc4 (diff)
downloadrust-86fa21cda57b7235e191926012ffa6e3b534e92b.tar.gz
rust-86fa21cda57b7235e191926012ffa6e3b534e92b.zip
Implement a finish method for the status_bar and some cleanup
Diffstat (limited to 'src/tools/rustdoc-gui/tester.js')
-rw-r--r--src/tools/rustdoc-gui/tester.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/tools/rustdoc-gui/tester.js b/src/tools/rustdoc-gui/tester.js
index 92535f34178..fcecd00bd53 100644
--- a/src/tools/rustdoc-gui/tester.js
+++ b/src/tools/rustdoc-gui/tester.js
@@ -5,6 +5,7 @@
 // ```
 const fs = require("fs");
 const path = require("path");
+const os = require('os');
 const {Options, runTest} = require('browser-ui-test');
 
 function showHelp() {
@@ -78,7 +79,7 @@ function char_printer(n_tests) {
         successful: function() {
             current += 1;
             if (current % max_per_line === 0) {
-                process.stdout.write(`. (${current}/${n_tests})\n`);
+                process.stdout.write(`. (${current}/${n_tests})${os.EOL}`);
             } else {
                 process.stdout.write(".");
             }
@@ -86,11 +87,15 @@ function char_printer(n_tests) {
         erroneous: function() {
             current += 1;
             if (current % max_per_line === 0) {
-                process.stderr.write(`F (${current}/${n_tests})\n`);
+                process.stderr.write(`F (${current}/${n_tests})${os.EOL}`);
             } else {
                 process.stderr.write("F");
             }
         },
+        finish: function() {
+            const spaces = " ".repeat(max_per_line - (current % max_per_line));
+            process.stdout.write(`${spaces} (${current}/${n_tests})${os.EOL}${os.EOL}`);
+        },
     };
 }
 
@@ -187,9 +192,10 @@ async function main(argv) {
             await tests[i];
         }
     }
-    await Promise.all(tests);
-    // final \n after the tests
-    console.log("\n");
+    if (!no_headless) {
+        await Promise.all(tests);
+    }
+    status_bar.finish();
 
     if (debug === false) {
         results.successful.sort(by_filename);