-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
101 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// +build testbincover | ||
|
||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/confluentinc/bincover" | ||
) | ||
|
||
func TestBincoverRunMain(t *testing.T) { | ||
bincover.RunTest(main) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
*.cid | ||
*.log | ||
*.log | ||
venom.test | ||
*.args.file | ||
*.cover.out | ||
*.error.out | ||
*.coverprofile | ||
*.out | ||
*.test.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
DIR=`dirname $0` | ||
NANO_TIMESTAMP=$(date +%s%N) | ||
|
||
# Prepare args file from current args | ||
rm -f $DIR/$NANO_TIMESTAMP.args.file | ||
for v in "$@" | ||
do | ||
echo $v >> $DIR/$NANO_TIMESTAMP.args.file | ||
done | ||
|
||
# Exec venom test binary, capture logs and exit code | ||
$DIR/venom.test -test.coverprofile=$DIR/$NANO_TIMESTAMP.coverprofile -test.run="^TestBincoverRunMain$" -args-file=$DIR/$NANO_TIMESTAMP.args.file 1> $DIR/$NANO_TIMESTAMP.out 2> $DIR/$NANO_TIMESTAMP.error.out | ||
EXI=$? | ||
|
||
# Print venom log on stdout and go test log in a dedicated file | ||
END_CTL_OUT=false | ||
while IFS="" read -r p || [ -n "$p" ] | ||
do | ||
if [[ $p == *"START_BINCOVER_METADATA" && "$p" != "START_BINCOVER_METADATA" ]]; then | ||
P=`printf '%s' "$p" | sed -e "s/START_BINCOVER_METADATA$//"` | ||
printf '%s\n' "$P" | ||
END_CTL_OUT=true | ||
echo "START_BINCOVER_METADATA" >> $DIR/$NANO_TIMESTAMP.test.out | ||
else | ||
if [ "$p" == "START_BINCOVER_METADATA" ]; then | ||
END_CTL_OUT=true | ||
fi | ||
if $END_CTL_OUT; then | ||
echo "$p" >> $DIR/$NANO_TIMESTAMP.test.out | ||
else | ||
printf '%s\n' "$p" | ||
fi | ||
fi | ||
done < $DIR/$NANO_TIMESTAMP.out | ||
|
||
exit $EXI |