summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Rue <dan.rue@linaro.org>2017-06-07 16:50:33 -0500
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-06-09 09:54:29 +0000
commitf51ede78c753c1aec86c05d052d8621c0d185b47 (patch)
tree80cebdee1163cdab709823896574aa127785466a
parentb592da1307402843b2c0e4bf914fa5f5daf22777 (diff)
test.sh: Support local testing environment
Add Dockerfiles that can build and run test-runner locally. test.sh provides a simple command line interface to the environment. This is just a start. We should be able to start implementing more robust tests and validations on top of test.sh and the 'test' dir. Change-Id: Idc1dc9a8752b244ba0c04427d9eb43ac19863377 Signed-off-by: Dan Rue <dan.rue@linaro.org>
-rw-r--r--automated/README16
-rwxr-xr-xtest.sh12
-rw-r--r--test/Dockerfile.centos13
-rw-r--r--test/Dockerfile.debian10
4 files changed, 51 insertions, 0 deletions
diff --git a/automated/README b/automated/README
index 26636f8..d6df927 100644
--- a/automated/README
+++ b/automated/README
@@ -54,3 +54,19 @@ Please find test results in the following locations.
- test-runner combines results of executed tests and save them in
${OUTPUT}/results.csv,
- ${OUTPUT} path of test-runner can be modified with '-o'
+
+Contributing
+============
+
+Changes need to be able to pass the following check, which will check files in
+the most recent commit:
+
+ python3 validate.py -g -s SC1091
+
+To develop locally, there are Dockerfiles in test/ that can be used to simulate
+target environments. The easiest way to use is to run `test.sh
+[debian|centos]`. test.sh will run validate.py, and then build the Docker
+environment specified, run plans/linux-example.yaml, and then drop into a bash
+shell inside the container so that things like /root/output can be inspected.
+It is not (yet) a pass/fail test; merely a development helper and validation
+environment.
diff --git a/test.sh b/test.sh
new file mode 100755
index 0000000..fbe3d1a
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+if [ -z "$1" ] || [ ! -e "test/Dockerfile.${1}" ]; then
+ echo "USAGE: $0 [debian|centos]"
+ exit 1
+fi
+
+python3 validate.py -g -s SC1091
+docker build -f test/Dockerfile."${1}" -t erp-"${1}" . && docker run --rm -it -v "$(pwd)":/work erp-"${1}"
+
diff --git a/test/Dockerfile.centos b/test/Dockerfile.centos
new file mode 100644
index 0000000..7ac6f03
--- /dev/null
+++ b/test/Dockerfile.centos
@@ -0,0 +1,13 @@
+FROM centos
+
+USER root
+
+RUN yum -y update && yum -y install epel-release
+RUN yum -y update && yum -y install vim python python-pip git
+
+COPY . /work
+WORKDIR /work
+RUN pip install -r automated/utils/requirements.txt
+
+CMD . ./automated/bin/setenv.sh && test-runner -p plans/linux-example.yaml && bash
+
diff --git a/test/Dockerfile.debian b/test/Dockerfile.debian
new file mode 100644
index 0000000..0bf0247
--- /dev/null
+++ b/test/Dockerfile.debian
@@ -0,0 +1,10 @@
+FROM python:2.7
+
+RUN apt-get update && apt-get install -y vim
+
+COPY . /work
+WORKDIR /work
+RUN pip install -r automated/utils/requirements.txt
+
+CMD . ./automated/bin/setenv.sh && test-runner -p plans/linux-example.yaml && bash
+