| OLD | NEW |
| 1 #!/bin/bash --norc | 1 #!/bin/bash --norc |
| 2 | 2 |
| 3 # Copyright (c) 2016, the Dart Team. All rights reserved. Use of this | 3 # Copyright (c) 2016, the Dart Team. All rights reserved. Use of this |
| 4 # source code is governed by a BSD-style license that can be found in | 4 # source code is governed by a BSD-style license that can be found in |
| 5 # the LICENSE file. | 5 # the LICENSE file. |
| 6 | 6 |
| 7 BUILD_DIR=../../test_reflectable | 7 BUILD_DIR=../../test_reflectable |
| 8 TIMESTAMP=$(date +"%Y%m%d-%H%M") | 8 TIMESTAMP=$(date +"%Y%m%d-%H%M") |
| 9 OUTPUT_FILE="/tmp/unexecuted-lines-$TIMESTAMP.txt" | 9 OUTPUT_FILE="/tmp/unexecuted-lines-$TIMESTAMP.txt" |
| 10 VM_PORT=43979 | 10 VM_PORT=43979 |
| 11 DART_VM_OPTIONS="--enable-vm-service:$VM_PORT -Dreflectable.pause.at.exit=true" | 11 TEST_COUNT=$(ls ../../test_reflectable/test/*_test.dart | wc -l) |
| 12 D_OPTION1="-Dreflectable.pause.at.exit=true" |
| 13 D_OPTION2="-Dreflectable.pause.at.exit.count=$TEST_COUNT" |
| 14 DART_VM_OPTIONS="--enable-vm-service:$VM_PORT $D_OPTION1 $D_OPTION2" |
| 12 export DART_VM_OPTIONS | 15 export DART_VM_OPTIONS |
| 13 ( cd $BUILD_DIR; pub build --mode=debug test ) & sleep 1 | 16 ( cd $BUILD_DIR; pub build --mode=debug test ) & sleep 1 |
| 14 | 17 |
| 15 dart --checked ./unexecuted_lines.dart $VM_PORT >$OUTPUT_FILE | 18 dart --checked ./unexecuted_lines.dart $VM_PORT >$OUTPUT_FILE |
| 16 echo "Raw output is stored in: $OUTPUT_FILE" | 19 echo "Raw output is stored in: $OUTPUT_FILE" |
| 17 echo | 20 echo |
| 18 | 21 |
| 19 cat $OUTPUT_FILE | while read line; do | 22 cat $OUTPUT_FILE | while read line; do |
| 20 if [[ "$line" =~ "package:reflectable/" ]]; then true; else continue; fi | 23 if [[ "$line" =~ "package:reflectable/" ]]; then true; else continue; fi |
| 21 tmp=${line#*/} | 24 tmp=${line#*/} |
| 22 filePath=${tmp%%:*} | 25 filePath=${tmp%%:*} |
| 23 lineNumber=${line##*:} | 26 lineNumber=${line##*:} |
| 24 code=$(tail --lines=+$lineNumber ../../reflectable/lib/$filePath | head -1) | 27 code=$(tail --lines=+$lineNumber ../../reflectable/lib/$filePath | head -1) |
| 25 echo "$line: $code" | 28 echo "$line: $code" |
| 26 done | 29 done |
| OLD | NEW |