Add support for LAVA_TEST_PLAN

Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
diff --git a/lava-submit.py b/lava-submit.py
index 5f7b602..97701b0 100755
--- a/lava-submit.py
+++ b/lava-submit.py
@@ -188,25 +188,26 @@
 
     git_repo = 'git://git.linaro.org/qa/test-definitions.git'
 
-    # tests set specific to an image
-    if distribution == 'openembedded':
-      tests = tests_openembedded_minimal
-    elif distribution == 'ubuntu' or distribution == 'quantal' or distribution == 'raring':
-      tests = tests_nano
-
-    # if ubuntu-desktop, cover more test cases (LEB)
-    if rootfs_type == 'ubuntu-desktop':
-        tests += tests_desktop
-
-    # if alip, specific tests like bootchart (which should be first)
-    if rootfs_type == 'alip':
-        tests = tests_alip + tests
-
-    if 'lamp' in rootfs_type:
-        tests += tests_openembedded_lamp
-
-    if 'leg-java' in rootfs_type:
-        tests += tests_openembedded_leg_java
+    lava_test_plan = os.environ.get('LAVA_TEST_PLAN')
+    if lava_test_plan is None:
+        # tests set specific to an image
+        if distribution == 'openembedded':
+            tests = tests_openembedded_minimal
+            if 'lamp' in rootfs_type:
+                tests += tests_openembedded_lamp
+            if 'leg-java' in rootfs_type:
+                tests += tests_openembedded_leg_java
+        elif distribution == 'ubuntu' or distribution == 'quantal' or distribution == 'raring':
+            tests = tests_nano
+            # if ubuntu-desktop, cover more test cases (LEB)
+            if rootfs_type == 'ubuntu-desktop':
+                tests += tests_desktop
+            # if alip, specific tests like bootchart (which should be first)
+            if rootfs_type == 'alip':
+                tests = tests_alip + tests
+    else:
+        lava_test_plan = lava_test_plan.strip("'")
+        tests = lava_test_plan.split()
 
     # removing bluetooth and wifi for devices that don't support it
     if device_type in ['beaglexm', 'vexpress-a9', 'mx53loco']: