|
1 #!/usr/bin/perl -w |
|
2 # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # |
|
16 |
|
17 use File::Path; |
|
18 use Cwd; |
|
19 |
|
20 #read config file |
|
21 open TESTS, $ARGV[0] or die "Cannot open $ARGV[0]"; |
|
22 %config = (testdriver => "", logdir => "", romdir => ""); |
|
23 CONFIG: while (<TESTS>) { |
|
24 last CONFIG if /\[tests\]/i; |
|
25 next CONFIG if /^\n/; |
|
26 chomp; |
|
27 ($var, $value) = split /=/, $_; |
|
28 if (exists $config{$var}) { |
|
29 $config{$var} = $value; |
|
30 } |
|
31 } |
|
32 #Save location of test list start |
|
33 $testspos = tell TESTS; |
|
34 |
|
35 print "td = ".$config{"testdriver"}."\n"; |
|
36 print "logdir = ".$config{"logdir"}."\n"; |
|
37 print "romdir = ".$config{"romdir"}."\n"; |
|
38 |
|
39 #delete old logs |
|
40 print "deleting ".$config{"logdir"}."\n"; |
|
41 rmtree($config{"logdir"}); |
|
42 |
|
43 $cwd = getcwd; |
|
44 chdir($config{"testdriver"}); |
|
45 |
|
46 #Build tests |
|
47 print "Building tests\n"; |
|
48 while(<TESTS>) { |
|
49 ($suite, $plat, $rel) = split /,/, $_; |
|
50 print "testdriver.exe build -p $plat -b $rel -s $suite\n"; |
|
51 system("testdriver.exe build -p $plat -b $rel -s $suite"); |
|
52 } |
|
53 #return to the beggining for later processing |
|
54 seek TESTS, $testspos, 0; |
|
55 |
|
56 #Run tests |
|
57 $numtests = 0; |
|
58 while(<TESTS>) { |
|
59 ($suite, $plat, $rel, $rom) = split /,/, $_; |
|
60 |
|
61 #Turn board on |
|
62 system("hardwareswitch off"); |
|
63 sleep(5); |
|
64 system("hardwareswitch on"); |
|
65 sleep(5); |
|
66 |
|
67 #Transfer rom to board |
|
68 system("\\epoc32\\release\\tools\\rel\\trgtest.exe 1 $config{'romdir'}\\$rom"); |
|
69 #I know, another hardcoded delay... but how is the script supposed to know when |
|
70 #the board has finished booting? |
|
71 sleep(200); |
|
72 system("testdriver.exe run -p $plat -b $rel -s $suite -t serial2"); |
|
73 $numtests++ |
|
74 } |
|
75 |
|
76 #Compile the log files |
|
77 chdir($cwd); |
|
78 system("perl \\build\\processLogs.pl $numtests $ARGV[0]"); |