ximpfw/tsrc/tsrcutils/eunitcommon/eunit_test_mover.pl
changeset 0 e6b17d312c8b
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     1 #
       
     2 # Copyright (c) 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: XIMP Framework Test Code 
       
    15 #
       
    16 #!perl
       
    17 #
       
    18 use strict;
       
    19 use File::Path;
       
    20 
       
    21 $|=1; # ensures that any progress information sent to the screen is displayed immediately and not buffered
       
    22 
       
    23 # When this script is used with build tools, move is done only for WINSCW platform 
       
    24 if ( exists($ENV{'PLATFORM'})  && 
       
    25      ($ENV{'PLATFORM'} ne 'WINSCW' ) )
       
    26 	{
       
    27 	print "\nEUnit Test DLL Mover: nothing to do for platform.\n";
       
    28 	exit 0;
       
    29 	}
       
    30 
       
    31 
       
    32 # destination folder where EUnit test dlls are placed
       
    33 my $destFolder = "\\epoc32\\release\\winscw\\udeb\\z\\sys\\bin";
       
    34 
       
    35 # ABLD command 
       
    36 # If this script is used with build chain, then "TO_BLDINF" env. variable points to the ABLD folder 
       
    37 # else use ABLD from current folder
       
    38 my $abldCommand = ""; 
       
    39 if (exists($ENV{'TO_BLDINF'}))
       
    40 	{
       
    41 	$abldCommand = $ENV{'TO_BLDINF'} . "\\abld build winscw udeb -what";	
       
    42 	}
       
    43 else
       
    44 	{
       
    45 	$abldCommand = "abld build winscw udeb -what";
       
    46 	}
       
    47 
       
    48 # get option
       
    49 my $option = $ARGV[0];
       
    50 
       
    51 # get all the files produced by the ABLD
       
    52 my @allProducedFiles = `$abldCommand`;
       
    53 
       
    54 # we're interested only from dlls
       
    55 my @dllList = grep{ $_=~m#^.+\.dll$#i }@allProducedFiles;
       
    56 
       
    57 print "\n";
       
    58 foreach my $dll (@dllList)
       
    59 	{
       
    60 	chomp($dll);
       
    61 
       
    62     # skip those which are not mt_, ut_, t_, dec_
       
    63     my @paths = split(/\\/, $dll);
       
    64     next unless (grep { $paths[-1] =~ m#^$_.+$#i; } (qw(mt_ ut_ t_ dec_)));
       
    65 
       
    66 	if( $option eq "-wipe" )
       
    67 		{
       
    68 		my($dllPath, $dllName) = $dll =~ m/(.*\\)(.*)$/;
       
    69 		$dll = $destFolder . "\\" . $dllName;
       
    70 		print "EUnit Test DLL Mover: CLEANING $dll\n";
       
    71 		rmtree $dll;
       
    72 		}
       
    73 	else
       
    74 		{
       
    75 		print "EUnit Test DLL Mover: COPYING $dll to $destFolder\n";
       
    76 		system "copy $dll ${destFolder}";
       
    77 		}
       
    78 	}
       
    79 	
       
    80