aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Christopher Vogt <oss.nsp@cvogt.org>2016-04-29 01:29:51 -0400
committerJan Christopher Vogt <oss.nsp@cvogt.org>2016-04-29 01:29:51 -0400
commitc48241614cf8ec19ca71db901be9b764ea494c63 (patch)
tree84ec7d639e5b54adfd9cc122913a71c91c1c875a
parent3f2b9430c2de4641fdb1126d3d4e1556de1504b6 (diff)
parent5952e7509cc3a73718d0393570d126fa0f60202f (diff)
downloadcbt-c48241614cf8ec19ca71db901be9b764ea494c63.tar.gz
cbt-c48241614cf8ec19ca71db901be9b764ea494c63.tar.bz2
cbt-c48241614cf8ec19ca71db901be9b764ea494c63.zip
Merge pull request #115 from cvogt/linux-compat
Linux compat
-rw-r--r--DEVELOPER_GUIDE.txt1
-rwxr-xr-xcbt31
-rw-r--r--circle.yml5
3 files changed, 24 insertions, 13 deletions
diff --git a/DEVELOPER_GUIDE.txt b/DEVELOPER_GUIDE.txt
index 5869257..b878a72 100644
--- a/DEVELOPER_GUIDE.txt
+++ b/DEVELOPER_GUIDE.txt
@@ -38,3 +38,4 @@ We strongly suggest well polished PRs, but don't want to stall improvements
by discussions about minor flaws. As long as the PR does not break anything and
improves the product, we should merge it, polishing remaining things afterwards.
+On OSX `brew install coreutils` to have gdate and get nanosecond timings during bash script.
diff --git a/cbt b/cbt
index 5d02917..0c5eaca 100755
--- a/cbt
+++ b/cbt
@@ -8,12 +8,27 @@
# - reduction of dependencies
# - performance improvements
-start_seconds=$(gdate +"%s")
-start_nanos=1$(gdate +"%N")
+seconds() {
+ date +"%s"
+}
+
+nanos() {
+ n=$(date +"%N")
+ if [ "$n" = "N" ]; then
+ n=$(gdate +"%N" 2>/dev/null)
+ fi
+ if [ "$n" = "" ]; then
+ n="0"
+ fi
+ echo $n
+}
+
+start_seconds=$(seconds)
+start_nanos=1$(nanos)
time_taken() {
- i=$(( $(gdate +"%s") - start_seconds ))
- n=$(( $(( 1$(gdate +"%N") - start_nanos )) / 1000000 ))
+ i=$(( $(seconds) - start_seconds ))
+ n=$(( $(( 1$(nanos) - start_nanos )) / 1000000 ))
if [[ ( "$n" < 0 ) ]]; then
i=$(( i-1 ))
n=$(( n+1000 ))
@@ -33,12 +48,8 @@ log () {
shift
done
if [ $enabled -eq 0 ]; then
- which gdate 2>&1 > /dev/null
- gdate_installed=$?
- if [ $gdate_installed -eq 0 ]; then
- delta=$(time_taken)
- echo "[$delta] $msg" 1>&2
- fi
+ delta=$(time_taken)
+ echo "[$delta] $msg" 1>&2
fi
}
diff --git a/circle.yml b/circle.yml
index 7d7be3e..ca40168 100644
--- a/circle.yml
+++ b/circle.yml
@@ -5,12 +5,11 @@ machine:
dependencies:
cache_directories:
- "cache"
- - "nailgun_launcher/target"
- - "stage1/target"
- - "stage2/target"
override:
+ - ./cbt compile -Dlog=all
- ./cbt direct -Dlog=all
- ./cbt -Dlog=all
+ - cd plugins/scalatest/ && ../../cbt compile -Dlog=all && cd ../../
test:
override: