From 9f46ffdc853670eb0512660c92e6f69c0db2b532 Mon Sep 17 00:00:00 2001
From: Emanuele Aina <emanuele.aina@collabora.com>
Date: Sat, 1 Jun 2019 02:04:49 +0200
Subject: [PATCH] test: Validate calls to the sample debos recipes in the
 README

Add a script to extract the debos calls in the README and run them to ensure
that they can be succesfully run on the SDK.

Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>
---
 test/test-sample-documentation | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100755 test/test-sample-documentation

diff --git a/test/test-sample-documentation b/test/test-sample-documentation
new file mode 100755
index 00000000..b260e3a7
--- /dev/null
+++ b/test/test-sample-documentation
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -e
+
+README=README.md
+
+fail () {
+    echo "$*" >&2
+    exit 2
+}
+
+test -r "$README" || fail "Unable to read '$README'"
+
+grep -o 'sudo debos.*' "$README" | while read CMD
+do
+    eval echo $CMD
+    eval $CMD
+done
+
+export SDCARD=./fake-sdcard.raw
+
+grep -o 'sudo bmaptool.*' "$README" | while read CMD
+do
+    eval echo $CMD
+    eval $CMD
+done
-- 
GitLab