summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2020-05-18 07:35:48 -0500
committerSean E. Russell <ser@ser1.net>2020-05-18 07:35:48 -0500
commitb8f3683f07015f0c6fbf3090aecd5ba1457ebe39 (patch)
treefa42c4d7d4edbe87c0ec0ed1e79ce21e8e3e896f /scripts
parentb47acdc8f2e037af1461805d9cd6dc1dcc71f5c1 (diff)
Release SVG a bit taller, and add the size test bisect script.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/size.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/size.sh b/scripts/size.sh
new file mode 100755
index 0000000..f772a77
--- /dev/null
+++ b/scripts/size.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# size.sh is used to bisect the repository and find changes that negatively
+# impacted the gotop binary size. It does this by building gotop and exiting
+# successfully if the binary size is under a defined amount.
+#
+# Example:
+# ```
+# git bisect start
+# git bisect bad master
+# git bisect good 755037d211cc8e58e9ce43ee74a95a3036053dee
+# git bisect run ./size
+# ```
+
+GOODSIZE=6000000
+
+# Caleb's directory structure was different from the current structure, so
+# we have to find the main package first.
+pt=$(dirname $(find . -name main.go))
+# Give the executable a unique-ish name
+fn=gotop_$(git rev-list -1 HEAD)
+go build -o $fn $pt
+sz=$(ls -l $fn | awk '{print $5}')
+git checkout -- .
+[[ $sz -gt $GOODSIZE ]] && exit 1
+exit 0