File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+ 'use strict' ;
3+
4+ /* This script gets the output of ctest and returns
5+ * the non-finished tests or the failed ones, useful
6+ * for detecting deadlocks. Use it like:
7+ * $ node find-deadlock-tests.js ctest_output_file.txt
8+ */
9+
10+ const { readFileSync } = require ( 'fs' ) ;
11+
12+ if ( ! process . argv [ 2 ] ) {
13+ console . error ( 'No file specified' ) ;
14+ process . exit ( 1 ) ;
15+ }
16+
17+ const file = readFileSync ( process . argv [ 2 ] ) ;
18+
19+ if ( ! file ) {
20+ console . error ( 'Failed to read the file' ) ;
21+ process . exit ( 2 ) ;
22+ }
23+
24+ const tests = file . toString ( ) . split ( '\n' ) . reduce ( ( tests , line ) => {
25+ const splitted = line . split ( ' ' ) . filter ( element => element ) ;
26+ if ( splitted [ 0 ] === 'Start' ) {
27+ tests . start . push ( splitted [ 2 ] ) ;
28+ } else if ( splitted [ 5 ] === 'Passed' ) {
29+ tests . finish . push ( splitted [ 3 ] ) ;
30+ }
31+ return tests ;
32+ } , { start : [ ] , finish : [ ] } ) ;
33+
34+ const deadlock = tests . start . filter ( x => ! tests . finish . includes ( x ) ) ;
35+
36+ console . log ( deadlock ) ;
You can’t perform that action at this time.
0 commit comments