1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
--- a/common/build.xml Mon May 11 17:31:24 2009 +0100
+++ b/common/build.xml Tue May 12 14:47:47 2009 +0100
@@ -146,7 +146,7 @@
<then>
<runtarget target="sf-get-source"/>
<runtarget target="sf-merge-epoc32"/>
-
+
<if><istrue value="${sf.spec.package.src.enable}"/>
<then>
<echo message="INFO Packaging Source"/>
@@ -187,6 +187,12 @@
</then>
</if>
+ <if><istrue value="${sf.spec.test.send.enable}"/>
+ <then>
+ <runtarget target="sf-send-testpkg"/>
+ </then>
+ </if>
+
<!-- PUBLISH LOGS/REPORTS -->
<if>
<istrue value="${sf.spec.publish.enable}" />
@@ -353,10 +359,43 @@
</target>
<target name="sf-package-binary" depends="sf-preprocess-package-config">
- <antcall target="sf-zip-content">
+ <!--antcall target="sf-zip-content">
<param name="zip.config.file" value="${sf.common.config.dir}/generated/zip.cfg.xml.ftl"/>
<param name="zip.target.name" value="bin" />
- </antcall>
+ </antcall-->
+
+ <if><available file="${build.drive}/rnd/internal/initial" type="dir" />
+ <then>
+ <!-- get listing of rnd location for exclude later -->
+ <antcall target="sf-list-dir" inheritAll="false">
+ <param name="sf.list.name" value="rnd_binaries"/>
+ <param name="sf.dir.location" value="${build.drive}/rnd/internal/initial"/>
+ </antcall>
+ <echo message="Packaging with exclude list"/>
+ <exec executable="7za" dir="${build.drive}" output="${build.log.dir}/zip_${build.id}_binaries_epoc32.log">
+ <arg value="a"/>
+ <arg value="-tzip"/>
+ <arg value="-x@${build.log.dir}/listdir_${build.id}_rnd_binaries.log"/>
+ <arg value="-x!epoc32\build"/>
+ <arg value="binaries_epoc.zip"/>
+ <arg value="epoc32\"/>
+ </exec>
+ </then>
+ <else>
+ <echo message="Packaging without exclude list"/>
+ <exec executable="7za" dir="${build.drive}" output="${build.log.dir}/zip_${build.id}_binaries_epoc32.log">
+ <arg value="a"/>
+ <arg value="-tzip"/>
+ <arg value="-x!epoc32\build"/> <!-- exclude -->
+ <arg value="binaries_epoc.zip"/>
+ <arg value="epoc32\"/>
+
+ </exec>
+ </else>
+ </if>
+ <if><available file="${build.drive}/binaries_epoc.zip"/>
+ <then><move file="${build.drive}/binaries_epoc.zip" todir="${build.drive}/output/zips/"/></then>
+ </if>
</target>
<target name="sf-merge-epoc32">
@@ -364,13 +403,25 @@
<if><available file="${build.drive}/rnd" type="dir" />
<then>
<echo message="RnD binaries found, fast-copying into ${build.drive}/epoc32 tree"/>
- <hlm:fastcopy todir="${build.drive}/epoc32" verbose="false" overwrite="true" threadCount="8">
+ <hlm:fastcopy todir="${build.drive}/epoc32" verbose="true" overwrite="true" threadCount="4">
<fileset dir="${build.drive}/rnd"/>
<regexpmapper from="^(.*)/(.*)/epoc32/(.*)" to="\3" handledirsep="true"/>
</hlm:fastcopy>
</then>
</if>
</target>
+
+ <target name="sf-send-testpkg">
+ <echo message="Sending test package ${sf.spec.test.package.name} to ${sf.spec.test.host.name}"/>
+ <exec executable="perl" dir="${sf.common.config.dir}/tools/" failonerror="true" output="${build.log.dir}/ATS_${build.id}_smoketest.log">
+ <arg value="ats3_testdrop.pl"/>
+ <arg value="${sf.spec.test.host.name}"/>
+ <arg value="${sf.spec.test.host.path}"/>
+ <arg value="${sf.spec.test.package.name}"/>
+ <arg value="${sf.spec.test.package.path}"/>
+ </exec>
+ </target>
+
</project>
--- a/common/common_props.ant.xml Mon May 11 17:31:24 2009 +0100
+++ b/common/common_props.ant.xml Tue May 12 14:47:47 2009 +0100
@@ -61,11 +61,19 @@
<!-- zip all logs before publish -->
<property name="sf.spec.logs.zip.enable" value="true"/>
-
- <!-- packaging options for bin/src-->
- <property name="sf.spec.package.bin.enable" value="false"/>
- <property name="sf.spec.package.src.enable" value="false"/>
-
+
+ <!-- packaging options for bin/src-->
+ <property name="sf.spec.package.bin.enable" value="false"/>
+ <property name="sf.spec.package.src.enable" value="false"/>
+
+ <!-- ATS client properties -->
+ <property name="sf.spec.test.sendpkg.enable" value="false"/>
+ <property name="sf.spec.test.host.name" value=""/>
+ <property name="sf.spec.test.host.path" value=""/>
+
+ <property name="sf.spec.test.package.name" value=""/>
+ <property name="sf.spec.test.package.path" value=""/>
+
</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/ats3_testdrop.pl Tue May 12 14:47:47 2009 +0100
@@ -0,0 +1,127 @@
+#!/usr/bin/perl
+
+use strict;
+use Getopt::Long;
+use File::Copy;
+use File::Spec;
+
+my $username = "admin";
+my $password = "admin";
+my $host;
+my $schedule;
+my $host_drop_path;
+my $local_drop_path;
+my $local_test_pkg;
+my $help;
+
+sub usage($);
+sub help();
+sub usage_error();
+
+my %optmap = ( 'host' => \$host,
+ 'local-test-pkg' => \$local_test_pkg,
+ 'host-drop-path' => \$host_drop_path,
+ 'local-drop-path' =>\$local_drop_path,
+ 'username' => \$username,
+ 'password' => \$password,
+ 'schedule' => \$schedule,
+ 'help' => \$help);
+
+GetOptions(\%optmap,
+ 'host=s',
+ 'local-test-pkg=s',
+ 'host-drop-path=s',
+ 'local-drop-path=s',
+ 'username=s',
+ 'password=s',
+ 'schedule=s',
+ 'help!')
+ or usage_error();
+
+if ($help) {
+ help();
+}
+
+usage_error(), unless (defined($host) && defined($local_test_pkg) && defined($local_drop_path) && defined($host_drop_path));
+
+my $cscript_help = `cscript /?`;
+die("Need command \"cscript\". Not in found"), if ($?);
+die("Need VB script wshTestRunX.vbs. Not found"), unless ( -f "wshTestRunX.vbs");
+die("Test drop path \"$local_drop_path\" not found"), unless ( -d "$local_drop_path");
+
+my ($vol,$dir,$pkg);
+my $local_test_drop;
+my $host_test_drop;
+
+if ($local_test_pkg =~ /^\.\.\.(.+)/ ) {
+ $pkg = $1;
+ $local_test_drop = File::Spec->catfile($local_drop_path,$pkg);
+ die("Test package file \"$local_test_drop\" not found"), unless ( -f "$local_test_drop");
+}
+else {
+ die("Test package file \"$local_test_pkg\" not found"), unless ( -f "$local_test_pkg");
+ ($vol,$dir,$pkg) = File::Spec->splitpath($local_test_pkg);
+ $local_test_drop = File::Spec->catfile($local_drop_path,$pkg);
+ my $lc_local_test_drop = lc($local_test_drop);
+ my $lc_local_test_pkg = lc($local_test_pkg);
+ if ("$lc_local_test_drop" ne "$lc_local_test_pkg") {
+ if (unlink($local_test_drop) == 0) {
+ die("Can't delete stale testdrop \"$local_test_drop\". $!");
+ }
+ else {
+ print("A stale testtop \"$local_test_drop\" existed. Deleted\n");
+ }
+ copy("$local_test_pkg","$local_test_drop")
+ or die("Cannot copy \"$local_test_pkg\" -> \"$local_test_drop\". $!");
+ }
+}
+$host_test_drop = File::Spec->catfile($host_drop_path,$pkg);
+
+$ENV{'ats3.host'} = $host;
+$ENV{'ats3.pathToDrop'} = $host_test_drop;
+$ENV{'ats3.username'} = $username;
+$ENV{'ats3.password'} = $password;
+$ENV{'ats3.schedule'} = $schedule, if defined($schedule);
+system("cscript wshTestRunX.vbs");
+die("\nTest drop failed: $!"), if ($?);
+print("\nTest drop done");
+
+exit 0;
+
+sub usage($)
+{
+ my $error = shift;
+ my $fh = $error == 0 ? *STDOUT : *STDERR;
+ print $fh "ats3_testdrop.pl\n" .
+ "Send a test drop to an ATS3 server for execution\n" .
+ "usage:\n" .
+ " ats3_testdrop.pl --help\n" .
+ " ats3_testdrop.pl --host=HOSTNAME --local-test-pkg=PKGFILE --local-drop-path=LOCALPATH " .
+ " --host-drop-path=HOSTPATH " .
+ "[--username=ATS3USERNAME] [--password=ATS3PASSWORD] [--schedule=DD.MM.YYYY-HH:MM]\n" .
+ "options:\n" .
+ " --help Display this help and exit\n" .
+ " --host=HOSTAME HOSTNAME is ATS3 server\n" .
+ " --local-test-pkg=PKGFILE PKGFILE is the test package.\n" .
+ " If PKGFILE begins "..." a filename in LOCALPATH is assumed\n" .
+ " --local-drop-path=LOCALPATH Path to local directory where PKGFILE will be dropped\n" .
+ " --host-drop-path=HOSTPATH Host directory that is mapped to LOCALPATH.\n" .
+ " Must agree with the properties of the registered device that the test package nominates\n" .
+ " --username=ATS3USERNAME ATS3 user to whome the test will belong. Default=admin\n" .
+ " --password=ATS3PASSWORD Password of ATS3 user. Default=admin\n" .
+ " --schedule=DD.MM.YYYY-HH:MM Date-time at which test is to run. Default=as soon as possible\n";
+ exit $error;
+}
+
+sub help()
+{
+ usage(0);
+}
+
+sub usage_error()
+{
+ usage(1);
+}
+
+# EOF
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/tester.bat Tue May 12 14:47:47 2009 +0100
@@ -0,0 +1,2 @@
+perl ats3_testdrop.pl --host=172.16.11.11 --local-test-pkg=...9.zip --local-drop-path=D:\ATS3\TestDrops --host-drop-path=T:\TestDrops
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/wshTestRunX.vbs Tue May 12 14:47:47 2009 +0100
@@ -0,0 +1,78 @@
+'
+' WScript that will invoke the test run execute functionality at ATS3 web server without installing any ATS3
+' specific programs on the local PC.
+'
+' Password must be given in encrypted format and the path to test drop must be in URLEncoded
+'
+' Usage cscript wshRunX.vbs <username> <password> <server hostname> <path to testDrop.zip>
+'
+
+' Get the command line arguments
+set args = WScript.Arguments
+
+' Check that all arguments have been specified
+Set objShell = WScript.CreateObject("WScript.Shell")
+Set env = objShell.Environment("Process")
+checkEnvVars(env)
+
+' Invoke the web application and write the result to stdOut
+WScript.StdOut.Write doTestRunX(env("ats3.username"), env("ats3.password"), env("ats3.host"), URLEncode( env("ats3.pathToDrop") ), URLEncode( env("ats3.schedule") ))
+
+' Quit the script
+Wscript.Quit
+
+Function checkEnvVars(env)
+ if env("ats3.username") = "" then
+ WScript.Echo "Environment variable ats3.username not specified"
+ WScript.Quit 1
+ elseif env("ats3.password") = "" then
+ WScript.Echo "Environment variable ats3.password not specified"
+ WScript.Quit 1
+ elseif env("ats3.host") = "" then
+ WScript.Echo "Environment variable ats3.host not specified"
+ WScript.Quit 1
+ elseif env("ats3.pathToDrop") = "" then
+ WScript.Echo "Environment variable ats3.pathToDrop not specified"
+ WScript.Quit 1
+ end if
+End Function
+
+' Invoke the ATS3 web application in given host with the specified username, password and file path
+Function doTestRunX(uname, password, hostName, pathToDrop, schedule)
+ On Error Resume Next
+
+ 'If the given hostname contain port, use it otherwise use the default 8080
+ if(InStr(1, hostName, ":", VBTEXTCOMPARE) = 0) then
+ hostName = hostName & ":8080"
+ end if
+
+ Set objxmlHTTP = CreateObject("Microsoft.XMLHTTP")
+ Call objxmlHTTP.open("GET", "http://" & hostName & "/ats3/XTestRunExecute.do?username=" & uname & "&password=" & password & "&testrunpath=" & pathToDrop & "&schedule=" & schedule, False)
+ objxmlHTTP.Send()
+ If Err.Number <> 0 Then
+ WScript.Echo "Error sending data to server: " + hostName
+ WScript.Quit 1
+ End if
+
+ if objxmlHTTP.status = 200 then
+ doTestRunX = objxmlHTTP.ResponseText
+ else
+ WScript.Echo "Error importing test run: " + objxmlHTTP.ResponseText
+ WScript.Quit 1
+ end if
+End Function
+
+Function URLEncode(data)
+ data = replace(data,"\","/")
+ data = replace(data,"$","%24")
+ data = replace(data,"&","%26")
+ data = replace(data,"+","%2B")
+ data = replace(data,",","%2C")
+ data = replace(data,"/","%2F")
+ data = replace(data,":","%3A")
+ data = replace(data,";","%3B")
+ data = replace(data,"=","%3D")
+ data = replace(data,"?","%3F")
+ data = replace(data,"@","%40")
+ URLEncode = data
+End Function
\ No newline at end of file