# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1544632841 0
#      Wed Dec 12 16:40:41 2018 +0000
# Node ID 8ce5b7ec930176e9f199178814137aac97b3886b
# Parent  194a739a612af1439a465a27e0e8d9b487a403d4
Extract environment checking in a separate script

We are about to add a bisect script that will need those checks.

diff --git a/launch.sh b/launch.sh
--- a/launch.sh
+++ b/launch.sh
@@ -1,30 +1,7 @@
 #!/bin/bash
 set -euox pipefail
 
-# Ensure asv now machine characteristics
-asv machine --yes
-
-echo check that system is ready for benchmark
-echo "(use ASV_SKIP_SYSTEM_CHECK=1 to skip it)"
-
-if [ -z "${ASV_SKIP_SYSTEM_CHECK:-}" ]; then
-    # Check that the machine is ready for benchmark
-    python -m perf system show
-fi
-
-# Ensure all repository are here
-
-if [ ! -d mercurial ]; then
-    hg clone https://www.mercurial-scm.org/repo/hg mercurial
-fi
-
-mkdir -p repos/
-mkdir -p repos/.cache
-make MAKE_VERBOSE=1 -f repos.make
-
-./repo-scripts/rename-reference-directories repos
-
-python create_skip_file.py
+./run-scripts/before-check.sh
 
 target="${1-1.9:: and tagged()}"
 if [ "$#" -ge 1 ]; then
diff --git a/run-scripts/before-check.sh b/run-scripts/before-check.sh
new file mode 100755
--- /dev/null
+++ b/run-scripts/before-check.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# Script used to check that the machine is ready for running benchmarks. This
+# script assumes that the asv command is in the current PATH
+
+set -eox pipefail
+
+# Ensure asv now machine characteristics
+asv machine --yes
+
+echo check that system is ready for benchmark
+echo "(use ASV_SKIP_SYSTEM_CHECK=1 to skip it)"
+
+if [ -z "${ASV_SKIP_SYSTEM_CHECK:-}" ]; then
+    # Check that the machine is ready for benchmark
+    python -m perf system show
+fi
+
+# Ensure all repository are here
+
+if [ ! -d mercurial ]; then
+    hg clone https://www.mercurial-scm.org/repo/hg mercurial
+fi
+
+mkdir -p repos/
+mkdir -p repos/.cache
+make MAKE_VERBOSE=1 -f repos.make
+
+./repo-scripts/rename-reference-directories repos
+
+python create_skip_file.py