changeset 170:62c425f76e9a

Add coverage script.
author Lewin Bormann <lbo@spheniscida.de>
date Sat, 12 Aug 2017 09:57:56 +0200
parents 394cba9504fe
children e3ecc44a0343
files .hgignore coverage.sh src/mem_env.rs
diffstat 3 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sun Jul 16 14:06:03 2017 +0200
+++ b/.hgignore	Sat Aug 12 09:57:56 2017 +0200
@@ -1,4 +1,6 @@
+.*.bk
+.*.orig
 .*.swp
+Cargo.lock
+kcov-out
 target
-.*.orig
-Cargo.lock
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coverage.sh	Sat Aug 12 09:57:56 2017 +0200
@@ -0,0 +1,12 @@
+
+#!/bin/bash
+
+KCOV=kcov
+KCOV_OPTS="--verify --exclude-pattern=/.cargo"
+KCOV_OUT="./kcov-out/"
+
+export RUSTFLAGS="-C link-dead-code"
+
+TEST_BIN=$(cargo test 2>&1 >/dev/null | awk '/^     Running target\/debug\// { print $2 }')
+
+${KCOV} ${KCOV_OPTS} ${KCOV_OUT} ${TEST_BIN} && xdg-open ${KCOV_OUT}/index.html
--- a/src/mem_env.rs	Sun Jul 16 14:06:03 2017 +0200
+++ b/src/mem_env.rs	Sat Aug 12 09:57:56 2017 +0200
@@ -10,9 +10,6 @@
 use std::path::Path;
 use std::sync::{Arc, Mutex};
 
-// TODO: implement in-memory file using buffer wrapped inside arc<mutex<>> supporting read, write,
-// randomaccess.
-
 fn path_to_string(p: &Path) -> String {
     p.to_str().map(String::from).unwrap()
 }