More on automated tests (re ticket:1111): work on Visual Studio target, and added ability to disable tests in configure.py

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@3300 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/tests/automated/configure.py b/tests/automated/configure.py
index fe5cabc..d277471 100755
--- a/tests/automated/configure.py
+++ b/tests/automated/configure.py
@@ -12,6 +12,8 @@
 build_type = ""
 vs_target = ""
 s60_target = ""
+no_test = False
+no_pjsua_test = False
 
 #
 # Get gcc version
@@ -123,7 +125,7 @@
 
 
 def replace_vars(text):
-	global vs_target, s60_target, build_type
+	global vs_target, s60_target, build_type, no_test, no_pjsua_test
 	suffix = ""
 
         os_info = platform.system() + platform.release() + "-" + platform.machine()
@@ -172,12 +174,15 @@
 
         while True:
                 if text.find("$(PJSUA-TESTS)") >= 0:
-			# Determine pjsua exe to use
-			exe = "../../pjsip-apps/bin/pjsua-" + suffix
-                        proc = subprocess.Popen(PYTHON + " runall.py --list-xml -e " + exe, 
-						cwd="../pjsua",
-                                                shell=True, stdout=subprocess.PIPE)
-                        content = proc.stdout.read()
+			if no_test==False and no_pjsua_test==False:
+				# Determine pjsua exe to use
+				exe = "../../pjsip-apps/bin/pjsua-" + suffix
+				proc = subprocess.Popen(PYTHON + " runall.py --list-xml -e " + exe, 
+							cwd="../pjsua",
+							shell=True, stdout=subprocess.PIPE)
+				content = proc.stdout.read()
+			else:
+				content = ""
                         text = text.replace("$(PJSUA-TESTS)", content)
                 elif text.find("$(GCC)") >= 0:
                         text = text.replace("$(GCC)", gcc_version("gcc"))
@@ -227,13 +232,19 @@
 			else:
 				cmd = "echo Success"
                         text = text.replace("$(NOP)", cmd)
+                elif text.find("$(NOTEST)") >= 0:
+			if no_test:
+				str = '"1"'
+			else:
+				str = '"0"'
+                        text = text.replace("$(NOTEST)", str)
                 else:
                         break
         return text
 
 
 def main(args):
-	global vs_target, s60_target, build_type
+	global vs_target, s60_target, build_type, no_test, no_pjsua_test
         output = sys.stdout
         usage = """Usage: configure.py [OPTIONS] scenario_template_file
 
@@ -255,6 +266,8 @@
 			names:
 			    - "gcce udeb"
 			    - "gcce urel"
+  -notest               Disable all tests in the scenario.
+  -nopjsuatest          Disable pjsua tests in the scenario.
 """
 
         args.pop(0)
@@ -294,6 +307,12 @@
 			if not ["vs", "gnu", "s60"].count(build_type):
 				sys.stderr.write("Error: invalid -t argument value\n")
 				sys.exit(1)
+		elif args[0]=='-notest' or args[0]=='-notests':
+			args.pop(0)
+			no_test = True
+		elif args[0]=='-nopjsuatest' or args[0]=='-nopjsuatests':
+			args.pop(0)
+			no_pjsua_test = True
 		else:
 			break
 
diff --git a/tests/automated/gnu-ipp.xml.template b/tests/automated/gnu-ipp.xml.template
index 96078c8..f6daf51 100644
--- a/tests/automated/gnu-ipp.xml.template
+++ b/tests/automated/gnu-ipp.xml.template
@@ -18,11 +18,11 @@
 		</FileWrite>
 		<Configure cmd='./aconfigure --enable-ipp --with-ipp="$(IPPROOT)" --with-ipp-samples="$(IPPSAMPLES)" --with-ipp-arch=$(IPPARCH)' />
 		<Build cmd="make dep &amp;&amp; make clean &amp;&amp; make" />
-		<Test name="pjlib-test" wdir="pjlib/bin" cmd="./pjlib-test-$(SUFFIX)" />
-		<Test name="pjlib-util-test" wdir="pjlib-util/bin" cmd="./pjlib-util-test-$(SUFFIX)" />
-		<Test name="pjnath-test" wdir="pjnath/bin" cmd="./pjnath-test-$(SUFFIX)" />
-		<Test name="pjmedia-test" wdir="pjmedia/bin" cmd="./pjmedia-test-$(SUFFIX)" />
-		<Test name="pjsip-test" wdir="pjsip/bin" cmd="./pjsip-test-$(SUFFIX)" />
+		<Test name="pjlib-test" wdir="pjlib/bin" cmd="./pjlib-test-$(SUFFIX)" disabled=$(NOTEST) />
+		<Test name="pjlib-util-test" wdir="pjlib-util/bin" cmd="./pjlib-util-test-$(SUFFIX)" disabled=$(NOTEST) />
+		<Test name="pjnath-test" wdir="pjnath/bin" cmd="./pjnath-test-$(SUFFIX)" disabled=$(NOTEST) />
+		<Test name="pjmedia-test" wdir="pjmedia/bin" cmd="./pjmedia-test-$(SUFFIX)" disabled=$(NOTEST) />
+		<Test name="pjsip-test" wdir="pjsip/bin" cmd="./pjsip-test-$(SUFFIX)" disabled=$(NOTEST) />
 		$(PJSUA-TESTS)
 	</Submit>
 </Scenario>
diff --git a/tests/automated/gnu.xml.template b/tests/automated/gnu.xml.template
index e488cc8..d453f44 100644
--- a/tests/automated/gnu.xml.template
+++ b/tests/automated/gnu.xml.template
@@ -18,11 +18,11 @@
 		</FileWrite>
 		<Configure cmd="./aconfigure" />
 		<Build cmd="make dep &amp;&amp; make clean &amp;&amp; make" />
-		<Test name="pjlib-test" wdir="pjlib/bin" cmd="./pjlib-test-$(SUFFIX)" />
-		<Test name="pjlib-util-test" wdir="pjlib-util/bin" cmd="./pjlib-util-test-$(SUFFIX)" />
-		<Test name="pjnath-test" wdir="pjnath/bin" cmd="./pjnath-test-$(SUFFIX)" />
-		<Test name="pjmedia-test" wdir="pjmedia/bin" cmd="./pjmedia-test-$(SUFFIX)" />
-		<Test name="pjsip-test" wdir="pjsip/bin" cmd="./pjsip-test-$(SUFFIX)" />
+		<Test name="pjlib-test" wdir="pjlib/bin" cmd="./pjlib-test-$(SUFFIX)" disabled=$(NOTEST) />
+		<Test name="pjlib-util-test" wdir="pjlib-util/bin" cmd="./pjlib-util-test-$(SUFFIX)" disabled=$(NOTEST) />
+		<Test name="pjnath-test" wdir="pjnath/bin" cmd="./pjnath-test-$(SUFFIX)" disabled=$(NOTEST) />
+		<Test name="pjmedia-test" wdir="pjmedia/bin" cmd="./pjmedia-test-$(SUFFIX)" disabled=$(NOTEST) />
+		<Test name="pjsip-test" wdir="pjsip/bin" cmd="./pjsip-test-$(SUFFIX)" disabled=$(NOTEST) />
 		$(PJSUA-TESTS)
 	</Submit>
 	
diff --git a/tests/automated/msvc.xml.template b/tests/automated/msvc.xml.template
index bd134c0..d4dc8ff 100644
--- a/tests/automated/msvc.xml.template
+++ b/tests/automated/msvc.xml.template
@@ -8,15 +8,16 @@
 /* Written by ccdash */
 #define PJ_HAS_IPV6		1
 #define PJMEDIA_HAS_G7221_CODEC 1
+#define PJ_TODO(x)
 ]]>			
 		</FileWrite>
 		<Configure cmd="cmd /c echo success" />
 		<Build cmd='vcbuild.exe /nologo /nohtmllog /nocolor /rebuild pjproject-vs8.sln "$(VSTARGET)|Win32"' />
-		<Test name="pjlib-test" info="" wdir="pjlib/bin" cmd="pjlib-test-i386-Win32-vc8-$(VSTARGET)" />
-		<Test name="pjlib-util-test" info="" wdir="pjlib-util/bin" cmd="pjlib-util-test-i386-Win32-vc8-$(VSTARGET)" />
-		<Test name="pjnath-test" info="" wdir="pjnath/bin" cmd="pjnath-test-i386-Win32-vc8-$(VSTARGET)" />
-		<Test name="pjmedia-test" info="" wdir="pjmedia/bin" cmd="pjmedia-test-i386-Win32-vc8-$(VSTARGET)" />
-		<Test name="pjsip-test" info="" wdir="pjsip/bin" cmd="pjsip-test-i386-Win32-vc8-$(VSTARGET)" />
+		<Test name="pjlib-test" info="" wdir="pjlib/bin" cmd="pjlib-test-i386-Win32-vc8-$(VSTARGET)" disabled=$(NOTEST)/>
+		<Test name="pjlib-util-test" info="" wdir="pjlib-util/bin" cmd="pjlib-util-test-i386-Win32-vc8-$(VSTARGET)" disabled=$(NOTEST) />
+		<Test name="pjnath-test" info="" wdir="pjnath/bin" cmd="pjnath-test-i386-Win32-vc8-$(VSTARGET)" disabled=$(NOTEST) />
+		<Test name="pjmedia-test" info="" wdir="pjmedia/bin" cmd="pjmedia-test-i386-Win32-vc8-$(VSTARGET)" disabled=$(NOTEST) />
+		<Test name="pjsip-test" info="" wdir="pjsip/bin" cmd="pjsip-test-i386-Win32-vc8-$(VSTARGET)" disabled=$(NOTEST) />
 		$(PJSUA-TESTS)
 	</Submit>
 	
diff --git a/tests/automated/prepare.xml.template b/tests/automated/prepare.xml.template
index c1f650b..cadfb34 100644
--- a/tests/automated/prepare.xml.template
+++ b/tests/automated/prepare.xml.template
@@ -27,6 +27,14 @@
 		 -->
 		<Test name="Configuring iPhone scenario" cmd="python configure.py -t gnu -o iphone.xml iphone.xml.template" />
 
+		<!-- MSVC target.
+		     Requirements:
+		      - Build from VS successfully
+		      - VS paths are set
+
+		 -->
+		<Test name="Configuring Visual Studio for Win32" cmd="python configure.py -t vs -vstarget Release -o msvc-win32.xml -nopjsuatest msvc.xml.template" />
+
 		<!-- Symbian target.
 		     Requirement:
 		       - EPOCROOT (modify below)
diff --git a/tests/automated/testvars.template b/tests/automated/testvars.template
index c938942..e3f5cf0 100644
--- a/tests/automated/testvars.template
+++ b/tests/automated/testvars.template
@@ -6,11 +6,14 @@
 OS = 		"$(OS)"
 PJDIR = 	"$(PJDIR)"
 SUFFIX = 	"$(SUFFIX)"
+NOTEST = 	"$(NOTEST)"
 
 S60 only:
 ------------------------------
 S60TARGET = 	"$(S60TARGET)"
 S60TARGETNAME = "$(S60TARGETNAME)"
+S60DEVICE = 	"$(S60DEVICE)"
+EPOCROOT = 	"$(EPOCROOT)"
 
 VS only:
 ------------------------------
@@ -22,3 +25,9 @@
 $(PJSUA-TESTS)
 ------------------------------
 
+OTHER:
+------------------------------
+IPPROOT
+IPPSAMPLES
+IPPARCH
+NOP (cmdline to do nothing)