Switch test coverage tool to new 'go tool cover'.

Also, make the coverage report test ldb and memdb instead of just sqlite3.
This commit is contained in:
Dave Collins 2014-01-19 02:35:41 -06:00
parent 0696c757fa
commit 27bc18ba2e
2 changed files with 112 additions and 68 deletions

View file

@ -1,17 +1,10 @@
#!/bin/sh #!/bin/sh
# This script uses gocov to generate a test coverage report. # This script uses go tool cover to generate a test coverage report.
# The gocov tool my be obtained with the following command: go test -coverprofile=cov.out && go tool cover -func=cov.out && rm -f cov.out
# go get github.com/axw/gocov/gocov echo "============================================================"
# (cd ldb && go test -coverprofile=cov.out && go tool cover -func=cov.out && \
# It will be installed to $GOPATH/bin, so ensure that location is in your $PATH. rm -f cov.out)
echo "============================================================"
# Check for gocov. (cd memdb && go test -coverprofile=cov.out && go tool cover -func=cov.out && \
type gocov >/dev/null 2>&1 rm -f cov.out)
if [ $? -ne 0 ]; then
echo >&2 "This script requires the gocov tool."
echo >&2 "You may obtain it with the following command:"
echo >&2 "go get github.com/axw/gocov/gocov"
exit 1
fi
(cd sqlite3 && gocov test | gocov report)

View file

@ -1,53 +1,104 @@
PASS
github.com/conformal/btcdb/sqlite3/sqliteblock.go SqliteDb.NewestSha 100.00% (25/25) coverage: 63.3% of statements
github.com/conformal/btcdb/sqlite3/sqlite.go SqliteDb.endTx 100.00% (20/20) ok github.com/conformal/btcdb 0.781s
github.com/conformal/btcdb/sqlite3/sqlite.go SqliteDb.close 100.00% (9/9) github.com\conformal\btcdb\db.go: AddDBDriver 100.0%
github.com/conformal/btcdb/sqlite3/sqlite.go SqliteDb.txop 100.00% (7/7) github.com\conformal\btcdb\db.go: CreateDB 100.0%
github.com/conformal/btcdb/sqlite3/sqliteblock.go SqliteBlockIterator.Row 100.00% (7/7) github.com\conformal\btcdb\db.go: OpenDB 100.0%
github.com/conformal/btcdb/sqlite3/sqlitedbcache.go SqliteDb.fetchTxCache 100.00% (7/7) github.com\conformal\btcdb\db.go: SupportedDBs 100.0%
github.com/conformal/btcdb/sqlite3/sqlitedbcache.go SqliteDb.FetchTxByShaList 100.00% (6/6) github.com\conformal\btcdb\log.go: init 100.0%
github.com/conformal/btcdb/sqlite3/sqlitetx.go SqliteDb.ExistsTxSha 100.00% (5/5) github.com\conformal\btcdb\log.go: DisableLog 100.0%
github.com/conformal/btcdb/sqlite3/sqlitedbcache.go SqliteDb.InvalidateBlockCache 100.00% (5/5) github.com\conformal\btcdb\log.go: UseLogger 0.0%
github.com/conformal/btcdb/sqlite3/sqlitedbcache.go SqliteDb.InvalidateTxCache 100.00% (5/5) github.com\conformal\btcdb\log.go: SetLogWriter 0.0%
github.com/conformal/btcdb/sqlite3/sqliteblock.go SqliteDb.InsertBlockData 100.00% (3/3) github.com\conformal\btcdb\log.go: GetLog 100.0%
github.com/conformal/btcdb/sqlite3/sqlite.go SqliteDb.Close 100.00% (3/3) total: (statements) 63.3%
github.com/conformal/btcdb/sqlite3/sqlite.go SqliteDb.Sync 100.00% (3/3) ============================================================
github.com/conformal/btcdb/sqlite3/sqlitetx.go SqliteDb.InsertTx 100.00% (3/3) PASS
github.com/conformal/btcdb/sqlite3/sqliteblock.go SqliteBlockIterator.Close 100.00% (2/2) coverage: 77.3% of statements
github.com/conformal/btcdb/sqlite3/sqlite.go CreateSqliteDB 100.00% (2/2) ok github.com/conformal/btcdb/ldb 0.581s
github.com/conformal/btcdb/sqlite3/sqlite.go OpenSqliteDB 100.00% (2/2) github.com\conformal\btcdb\ldb\block.go: FetchBlockBySha 100.0%
github.com/conformal/btcdb/sqlite3/sqlitedbcache.go SqliteDb.InvalidateCache 100.00% (2/2) github.com\conformal\btcdb\ldb\block.go: fetchBlockBySha 75.0%
github.com/conformal/btcdb/sqlite3/sqlitedbcache.go SqliteDb.FetchTxBufBySha 100.00% (2/2) github.com\conformal\btcdb\ldb\block.go: getBlkLoc 75.0%
github.com/conformal/btcdb/sqlite3/sqlitedbcache.go SqliteDb.FetchTxBySha 100.00% (2/2) github.com\conformal\btcdb\ldb\block.go: getBlkByHeight 100.0%
github.com/conformal/btcdb/sqlite3/sqlite.go init 100.00% (1/1) github.com\conformal\btcdb\ldb\block.go: getBlk 77.8%
github.com/conformal/btcdb/sqlite3/sqlitetx.go SqliteDb.FetchLocationBySha 100.00% (1/1) github.com\conformal\btcdb\ldb\block.go: setBlk 85.7%
github.com/conformal/btcdb/sqlite3/sqliteblock.go SqliteBlockIterator.NextRow 100.00% (1/1) github.com\conformal\btcdb\ldb\block.go: insertBlockData 86.7%
github.com/conformal/btcdb/sqlite3/sqlitetx.go SqliteDb.insertTx 96.77% (30/31) github.com\conformal\btcdb\ldb\block.go: fetchSha 83.3%
github.com/conformal/btcdb/sqlite3/sqlitedbcache.go SqliteDb.insertBlockCache 92.31% (12/13) github.com\conformal\btcdb\ldb\block.go: ExistsSha 100.0%
github.com/conformal/btcdb/sqlite3/sqliteblock.go SqliteDb.FetchBlockShaByHeight 91.67% (11/12) github.com\conformal\btcdb\ldb\block.go: blkExistsSha 75.0%
github.com/conformal/btcdb/sqlite3/sqlitedbcache.go SqliteDb.insertTxCache 91.67% (11/12) github.com\conformal\btcdb\ldb\block.go: FetchBlockShaByHeight 0.0%
github.com/conformal/btcdb/sqlite3/sqlite.go SqliteDb.rePlayTransaction 90.00% (18/20) github.com\conformal\btcdb\ldb\block.go: fetchBlockShaByHeight 0.0%
github.com/conformal/btcdb/sqlite3/sqliteblock.go SqliteDb.NewIterateBlocks 88.24% (15/17) github.com\conformal\btcdb\ldb\block.go: FetchHeightRange 94.4%
github.com/conformal/btcdb/sqlite3/sqlite.go SqliteDb.RollbackClose 87.50% (7/8) github.com\conformal\btcdb\ldb\block.go: NewestSha 100.0%
github.com/conformal/btcdb/sqlite3/sqliteblock.go SqliteDb.fetchSha 85.71% (12/14) github.com\conformal\btcdb\ldb\block.go: NewIterateBlocks 0.0%
github.com/conformal/btcdb/sqlite3/sqliteblock.go SqliteDb.ExistsSha 85.71% (6/7) github.com\conformal\btcdb\ldb\dbcache.go: InvalidateTxCache 0.0%
github.com/conformal/btcdb/sqlite3/sqliteblock.go SqliteDb.FetchHeightRange 84.62% (22/26) github.com\conformal\btcdb\ldb\dbcache.go: InvalidateBlockCache 0.0%
github.com/conformal/btcdb/sqlite3/sqliteblock.go SqliteDb.insertBlockData 84.00% (21/25) github.com\conformal\btcdb\ldb\dbcache.go: InvalidateCache 0.0%
github.com/conformal/btcdb/sqlite3/sqlitetx.go SqliteDb.fetchLocationBySha 84.00% (21/25) github.com\conformal\btcdb\ldb\leveldb.go: init 100.0%
github.com/conformal/btcdb/sqlite3/sqlitedbcache.go SqliteDb.FetchBlockBySha 83.33% (10/12) github.com\conformal\btcdb\ldb\leveldb.go: OpenDB 97.1%
github.com/conformal/btcdb/sqlite3/sqlitedbcache.go SqliteDb.fetchBlockCache 83.33% (5/6) github.com\conformal\btcdb\ldb\leveldb.go: openDB 75.0%
github.com/conformal/btcdb/sqlite3/sqlitetx.go SqliteDb.FetchTxUsedBySha 82.61% (19/23) github.com\conformal\btcdb\ldb\leveldb.go: CreateDB 100.0%
github.com/conformal/btcdb/sqlite3/sqliteblock.go insertGenesisBlock 81.82% (9/11) github.com\conformal\btcdb\ldb\leveldb.go: close 100.0%
github.com/conformal/btcdb/sqlite3/sqlite.go newOrCreateSqliteDB 79.25% (42/53) github.com\conformal\btcdb\ldb\leveldb.go: Sync 100.0%
github.com/conformal/btcdb/sqlite3/sqlitetx.go SqliteDb.existsTxSha 78.95% (15/19) github.com\conformal\btcdb\ldb\leveldb.go: Close 100.0%
github.com/conformal/btcdb/sqlite3/sqlite.go SqliteDb.startTx 78.57% (11/14) github.com\conformal\btcdb\ldb\leveldb.go: DropAfterBlockBySha 80.6%
github.com/conformal/btcdb/sqlite3/sqliteblock.go SqliteDb.blkExistsSha 77.78% (7/9) github.com\conformal\btcdb\ldb\leveldb.go: InsertBlock 43.9%
github.com/conformal/btcdb/sqlite3/sqlitedbcache.go SqliteDb.FetchTxAllBySha 77.14% (27/35) github.com\conformal\btcdb\ldb\leveldb.go: SetDBInsertMode 0.0%
github.com/conformal/btcdb/sqlite3/sqlitetx.go SqliteDb.migrateTmpTable 76.67% (46/60) github.com\conformal\btcdb\ldb\leveldb.go: doSpend 90.0%
github.com/conformal/btcdb/sqlite3/sqlite.go SqliteDb.SetDBInsertMode 74.07% (20/27) github.com\conformal\btcdb\ldb\leveldb.go: unSpend 90.0%
github.com/conformal/btcdb/sqlite3/sqlite.go SqliteDb.syncPoint 71.43% (5/7) github.com\conformal\btcdb\ldb\leveldb.go: setSpentData 100.0%
github.com/conformal/btcdb/sqlite3/sqlite.go createDB 70.59% (12/17) github.com\conformal\btcdb\ldb\leveldb.go: clearSpentData 100.0%
github.com/conformal/btcdb/sqlite3/sqlite.go SqliteDb.DropAfterBlockBySha 68.57% (24/35) github.com\conformal\btcdb\ldb\leveldb.go: setclearSpentData 93.2%
github.com/conformal/btcdb/sqlite3/sqlite.go SqliteDb.InsertBlock 46.00% (23/50) github.com\conformal\btcdb\ldb\leveldb.go: int64ToKey 100.0%
github.com/conformal/btcdb/sqlite3 ------------------------------ 82.14% (584/711) github.com\conformal\btcdb\ldb\leveldb.go: shaBlkToKey 100.0%
github.com\conformal\btcdb\ldb\leveldb.go: shaTxToKey 100.0%
github.com\conformal\btcdb\ldb\leveldb.go: shaSpentTxToKey 100.0%
github.com\conformal\btcdb\ldb\leveldb.go: lBatch 100.0%
github.com\conformal\btcdb\ldb\leveldb.go: processBatches 78.6%
github.com\conformal\btcdb\ldb\leveldb.go: RollbackClose 100.0%
github.com\conformal\btcdb\ldb\tx.go: InsertTx 0.0%
github.com\conformal\btcdb\ldb\tx.go: insertTx 100.0%
github.com\conformal\btcdb\ldb\tx.go: formatTx 66.7%
github.com\conformal\btcdb\ldb\tx.go: getTxData 69.2%
github.com\conformal\btcdb\ldb\tx.go: getTxFullySpent 75.0%
github.com\conformal\btcdb\ldb\tx.go: formatTxFullySpent 65.2%
github.com\conformal\btcdb\ldb\tx.go: ExistsTxSha 100.0%
github.com\conformal\btcdb\ldb\tx.go: existsTxSha 75.0%
github.com\conformal\btcdb\ldb\tx.go: FetchTxByShaList 100.0%
github.com\conformal\btcdb\ldb\tx.go: FetchUnSpentTxByShaList 100.0%
github.com\conformal\btcdb\ldb\tx.go: fetchTxDataBySha 100.0%
github.com\conformal\btcdb\ldb\tx.go: fetchTxDataByLoc 64.3%
github.com\conformal\btcdb\ldb\tx.go: FetchTxBySha 55.6%
total: (statements) 76.9%
============================================================
PASS
coverage: 44.2% of statements
ok github.com/conformal/btcdb/memdb 0.454s
github.com\conformal\btcdb\memdb\driver.go: init 100.0%
github.com\conformal\btcdb\memdb\driver.go: OpenDB 0.0%
github.com\conformal\btcdb\memdb\driver.go: CreateDB 100.0%
github.com\conformal\btcdb\memdb\memdb.go: newShaHashFromStr 100.0%
github.com\conformal\btcdb\memdb\memdb.go: isCoinbaseInput 75.0%
github.com\conformal\btcdb\memdb\memdb.go: isFullySpent 0.0%
github.com\conformal\btcdb\memdb\memdb.go: removeTx 0.0%
github.com\conformal\btcdb\memdb\memdb.go: Close 100.0%
github.com\conformal\btcdb\memdb\memdb.go: DropAfterBlockBySha 23.5%
github.com\conformal\btcdb\memdb\memdb.go: ExistsSha 62.5%
github.com\conformal\btcdb\memdb\memdb.go: FetchBlockBySha 44.4%
github.com\conformal\btcdb\memdb\memdb.go: FetchBlockShaByHeight 33.3%
github.com\conformal\btcdb\memdb\memdb.go: FetchHeightRange 19.0%
github.com\conformal\btcdb\memdb\memdb.go: ExistsTxSha 62.5%
github.com\conformal\btcdb\memdb\memdb.go: FetchTxBySha 20.0%
github.com\conformal\btcdb\memdb\memdb.go: fetchTxByShaList 33.3%
github.com\conformal\btcdb\memdb\memdb.go: FetchTxByShaList 100.0%
github.com\conformal\btcdb\memdb\memdb.go: FetchUnSpentTxByShaList 100.0%
github.com\conformal\btcdb\memdb\memdb.go: InsertBlock 51.7%
github.com\conformal\btcdb\memdb\memdb.go: InvalidateBlockCache 100.0%
github.com\conformal\btcdb\memdb\memdb.go: InvalidateCache 100.0%
github.com\conformal\btcdb\memdb\memdb.go: InvalidateTxCache 100.0%
github.com\conformal\btcdb\memdb\memdb.go: NewIterateBlocks 100.0%
github.com\conformal\btcdb\memdb\memdb.go: NewestSha 36.4%
github.com\conformal\btcdb\memdb\memdb.go: RollbackClose 100.0%
github.com\conformal\btcdb\memdb\memdb.go: SetDBInsertMode 100.0%
github.com\conformal\btcdb\memdb\memdb.go: Sync 100.0%
github.com\conformal\btcdb\memdb\memdb.go: newMemDb 100.0%
total: (statements) 44.2%