common/tools/test/pckg_status/scripts/check_pckg_test_status.pl
author Arnaud Lenoir
Tue, 12 Jan 2010 17:18:11 +0000
changeset 840 3b9cc38657db
permissions -rw-r--r--
Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
840
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     1
# Copyright (c) 2009 Symbian Foundation Ltd
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     2
# This component and the accompanying materials are made available
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     3
# under the terms of the License "Eclipse Public License v1.0"
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     4
# which accompanies this distribution, and is available
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     5
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     6
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     7
# Script name: check_pckg_test_status.pl
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     8
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     9
# Initial Contributors:
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    11
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    12
# Contributors:
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    13
# Arnaud Lenoir <arnaudl@symbian.org>
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    14
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    15
# Created 27/11/2009
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    16
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    17
# Description:
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    18
# Task 286 - Package test status prep
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    19
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    20
# This script must be used at package level only!!!!
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    21
# For a general search to several packages, PDK, etc then use check_all_pckg_test_status.pl script
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    22
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    23
# Parameters passed:
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    24
#	Param1: Path to the root directory for the package (where the package_definition.xml is present)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    25
#	Param2: Path to the file containing the different patterns to have a look for
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    26
#	Param3: Path to the directory where DB will be published
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    27
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    28
# Modules necessary to run this script
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    29
use Getopt::Long;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    30
use strict;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    31
use Text::CSV;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    32
use Switch;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    33
use Data::Dumper;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    34
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    35
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    36
# Variables for parameters
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    37
my $help;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    38
my $package_path;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    39
my $pattern_file_path;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    40
my $publication_directory_path;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    41
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    42
# variables
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    43
my $system_cmd;		# Used to execute DOS commands
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    44
my $pckg_name="";	# Contains the name of the package
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    45
my @key_dirs_tab;	# Used to trace the patterns/keys for directories search
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    46
my %dirs_hashes;	# Contains the list of directories found hash_array=fct(directory_name(key),directory_path(values that are tables)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    47
my @key_files_tab;	# Used to trace the patterns/keys for files search
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    48
my %files_hashes;	# Contains the list of files found hash_array=fct(file_name(key),file_path(values that are tables)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    49
my @key_pattern_in_file_tab;	# Used to trace the patterns/keys for pattern in file search
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    50
my %pattern_in_file_hashes;		# Contains the list of files that contains the pattern found hash_array=fct(file_name(key),file_path(values that are tables)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    51
my @key_file_in_dir_tab;	# Used to trace the patterns/keys for file in directory search
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    52
my %file_in_dir_hashes;		# Contains the list of files that are in a specific directory hash_array=fct(file_name(key),file_path(values that are tables)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    53
my @directory;		# Used to extract data from the csv file that contains the different patterns to look for
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    54
my @file;			# Used to extract data from the csv file that contains the different patterns to look for
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    55
my @pattern;		# Used to extract data from the csv file that contains the different patterns to look for
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    56
my @test_type;		# Used to extract data from the csv file that contains the different patterns to look for
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    57
my %existing_tests;	# Hash array that record the tests that are supported / exist for the package.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    58
my %patterns_anywhere_hashes;	# Hash array that record the list of file / directory that contain a specific pattern using pattern as key which point to a table with the data gathered.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    59
my %patterns_anywhere_in_dir_hashes;	# Hash array that record the list of files that contain a specific pattern in a directory.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    60
my %patterns_in_dir_in_file_hashes;	# Hash array that record the list of files that contain a specific pattern in a directory and in a file that is included in tha directory (or sub-directory).
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    61
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    62
# Constantes declaration
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    63
my $default_publication_directory_path = "\.\\results";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    64
my $default_pattern_file_path = ".\\pckg_test_status_patterns.csv";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    65
my $output_file_base_name = "package_test_status_";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    66
my $output_file_extension = ".xml";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    67
my $csv_status_file_name = "packages_tests_supported_status.csv";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    68
# Used for search algorithm
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    69
# Directory		File	Pattern		Value	Action
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    70
#	0			 0			1		  1		Look for pattern anywhere in a file, directory/file name
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    71
#	0			 1			0		  2		Look for a file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    72
#	0			 1			1		  3		Look for a pattern in a file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    73
#	1			 0			0		  4		Look for a directory
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    74
#	1			 0			1		  5		Look for a pattern in the directory anywhere in a directory/file name
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    75
#	1			 1			0		  6		Look for a file in a directory
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    76
#	1			 1			1		  7		Look for a pattern in a specific file in a specific directory
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    77
my $search_algo_4_pattern_anywhere = 1;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    78
my $search_algo_4_file = 2;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    79
my $search_algo_4_pattern_in_file = 3;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    80
my $search_algo_4_directory = 4;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    81
my $search_algo_4_pattern_anywhere_in_directory = 5;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    82
my $search_algo_4_file_in_directory = 6;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    83
my $search_algo_4_pattern_in_specific_file_directory = 7;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    84
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    85
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    86
my $nb_arg_passed = scalar(@ARGV);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    87
if(!$nb_arg_passed)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    88
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    89
	print "No arguments/parameters passed then print help!\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    90
	helpme();
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    91
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    92
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    93
my %optmap = (  'package_path' => \$package_path,
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    94
			    'pattern_file_path' => \$pattern_file_path,
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    95
				'publication_directory_path' => \$publication_directory_path,
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    96
                'help' => \$help);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    97
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    98
GetOptions(\%optmap,
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    99
		  'package_path=s',
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   100
		  'pattern_file_path=s',
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   101
		  'publication_directory_path=s',
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   102
          'help');
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   103
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   104
print "The value for help is: <$help>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   105
print "package_path: <$package_path>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   106
print "pattern_file_path: <$pattern_file_path>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   107
print "publication_directory_path: <$publication_directory_path>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   108
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   109
# Check if we need default values for some of the parameters
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   110
# Publication directory
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   111
if (!defined($publication_directory_path))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   112
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   113
	print "No publication_directory_path passed as argument, therefore use default path\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   114
	$publication_directory_path = $default_publication_directory_path;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   115
	print "publication_directory_path = <$publication_directory_path>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   116
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   117
# Check if we have a directory use for publishing. If not create it
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   118
#print "Check if $publication_directory_path exist or not!\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   119
if (!(-d $publication_directory_path))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   120
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   121
	print "The directory $publication_directory_path, doesn't exist, therefore we create it\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   122
	$system_cmd = "mkdir $publication_directory_path";	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   123
	print "Exec: $system_cmd\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   124
	system($system_cmd);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   125
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   126
# Patterns file used
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   127
if (!defined($pattern_file_path))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   128
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   129
	print "No specific patterns file has been passed as parameters, therefore we use default patterns file\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   130
	$pattern_file_path = $default_pattern_file_path;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   131
	print "pattern_file_path = <$pattern_file_path>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   132
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   133
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   134
if ($help)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   135
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   136
	print "We want to print the help\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   137
	helpme();
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   138
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   139
else
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   140
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   141
	print "\nIt's from here that the real work starts!\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   142
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   143
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   144
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   145
# Define if the path given as a package_definition*.xml file.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   146
# If yes, the directroy correspond to the package name.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   147
# If no, then there is a problem, and therefore we should stop.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   148
# 1. Check that the path contains the package_definition*.xml.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   149
# 2. Extract package name from path given. 
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   150
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   151
print "Package name to extract from: $package_path\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   152
if($package_path =~ m;\\([\w]+)$;)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   153
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   154
	$pckg_name = $1;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   155
	print "########################################################################\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   156
	print "\t\tThe Package name is: <$pckg_name>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   157
	print "########################################################################\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   158
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   159
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   160
# Load file with patterns
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   161
# If file doesn't exist, then exit
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   162
# Then
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   163
# Extract patterns from file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   164
# Store in tables/hash array???
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   165
# Count number of lines in the file - header!
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   166
# Check for column name and stick it in the appropriate table
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   167
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   168
print "Open the patterns file .csv and extract data from it.\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   169
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   170
open(PATTERNSFILE, "$pattern_file_path") or die "Can't open file $pattern_file_path. The error is <$!>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   171
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   172
#my $csv = Text::CSV->new({blank_is_undef => 1});
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   173
#my $csv = Text::CSV->new({empty_is_undef => 1});
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   174
my $csv = Text::CSV->new();
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   175
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   176
my $header=0;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   177
my $count_nb_total_lines=0;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   178
my @columns;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   179
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   180
while (<PATTERNSFILE>) {
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   181
	if ($csv->parse($_)) 
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   182
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   183
		@columns = $csv->fields();
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   184
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   185
		if(!$header)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   186
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   187
			#print "This is the first line of the csv file\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   188
			$header=1;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   189
			foreach (@columns) 
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   190
			{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   191
				#print $_."\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   192
			}			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   193
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   194
		else
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   195
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   196
			#print "line #$count_nb_total_lines of the csv file\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   197
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   198
			foreach (@columns) 
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   199
			{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   200
				#print "<$_>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   201
			}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   202
			push(@directory, $columns[0]);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   203
			push(@file, $columns[1]);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   204
			push(@pattern, $columns[2]);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   205
			push(@test_type, $columns[3]);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   206
			$count_nb_total_lines++;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   207
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   208
	} 
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   209
	else 
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   210
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   211
		my $err = $csv->error_input;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   212
		print "Failed to parse line: $err";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   213
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   214
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   215
print "The number of lines counted in the CSV file is: $count_nb_total_lines\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   216
print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   217
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   218
# Used to display the tables that extracted from the CSV file to check if data are correct
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   219
#for (my $i=0;$i<$count_nb_total_lines;$i++)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   220
#{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   221
#	print "$i:\t$directory[$i]\t\t$file[$i]\t\t$pattern[$i]\t\t\t$test_type[$i]\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   222
#}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   223
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   224
close(PATTERNSFILE);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   225
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   226
# Establish the list of type file we have in the package
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   227
# 1. Create the table that contains the list of all the type of tests listed in the CSV file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   228
# 1.a Create a hash array with table "test_type"
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   229
# 1.b Keep only one entry of each
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   230
# 2. Make sure that we fill it as we go along
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   231
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   232
#display_array("Type of test",@test_type);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   233
foreach (@test_type)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   234
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   235
	#print "The test type is: $_\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   236
	$existing_tests{$_} = "";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   237
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   238
#print "List of type of tests we are looking for\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   239
#print Dumper(\%existing_tests);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   240
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   241
# Look for patterns and fill tables
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   242
# foreach lines 
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   243
# 7 different outputs depending on the line contain
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   244
# directory, file and pattern (see Excel spreadsheet called "patterns_search_rules.xlsx")
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   245
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   246
my $select_search_type;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   247
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   248
my $count =0;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   249
while($count<$count_nb_total_lines)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   250
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   251
	#print "count=$count\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   252
	$select_search_type = 0;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   253
	if($directory[$count] ne "")
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   254
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   255
		$select_search_type += 4;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   256
		#print "A directory value exist => select_search_type= <$select_search_type>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   257
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   258
	if($file[$count] ne "")
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   259
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   260
		$select_search_type += 2;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   261
		#print "A file value exist => select_search_type= <$select_search_type>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   262
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   263
	if($pattern[$count] ne "")
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   264
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   265
		$select_search_type += 1;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   266
		#print "A pattern value exist => select_search_type= <$select_search_type>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   267
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   268
	#print "select_search_type= <$select_search_type>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   269
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   270
	switch($select_search_type)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   271
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   272
		case ($search_algo_4_pattern_anywhere)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   273
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   274
			print "Value is $search_algo_4_pattern_anywhere, meaning call fct_search_algo_4_pattern_anywhere\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   275
			my @pattern_anywhere_returned_table = fct_search_algo_4_pattern_anywhere($pattern[$count]);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   276
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   277
			push (@{ $patterns_anywhere_hashes {$pattern[$count]} }, @pattern_anywhere_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   278
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   279
			my $calcul_tab_size = scalar(@pattern_anywhere_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   280
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   281
			if($calcul_tab_size)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   282
			{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   283
				print "There is data for this search: <$calcul_tab_size>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   284
				$existing_tests{$test_type[$count]}++;	# Add 1 to the count for the type of test supported
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   285
			}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   286
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   287
		case ($search_algo_4_file)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   288
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   289
			print "Value is $search_algo_4_file, meaning call fct_search_algo_4_file\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   290
			my @files_returned_table = fct_search_algo_4_file($file[$count]);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   291
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   292
			# Display table in a nice way
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   293
			#display_array("files ".$file[$count],@files_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   294
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   295
			# Check if the key exists or not. If it doesn't exist then add it to the list
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   296
			@key_files_tab = add_key_for_dynamic_hash_array($file[$count], @key_files_tab);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   297
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   298
			# Save table containing files list returned by fct in the hash array to key file pattern
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   299
			# hash array: files_hashes
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   300
			# contains a key called file_pattern1 ($file[$count]) which contains the table @files_returned_table that lists the files found having for name file_pattern1
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   301
			# contains a key called file_pattern2 ($file[$count]) which contains the table @filess_returned_table that lists the files found having for name file_pattern2
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   302
			# Contain as many key as we are looking for files
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   303
			push (@{ $files_hashes{$file[$count]} }, @files_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   304
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   305
			my $calcul_tab_size = scalar(@files_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   306
			if($calcul_tab_size)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   307
			{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   308
				print "There is data for this search: <$calcul_tab_size>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   309
				$existing_tests{$test_type[$count]}++;	# Add 1 to the count for the type of test supported
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   310
			}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   311
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   312
		case ($search_algo_4_pattern_in_file)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   313
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   314
			print "Value is $search_algo_4_pattern_in_file, meaning call fct_search_algo_4_pattern_in_file\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   315
			# Hash array filling level 1 deepnees
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   316
			my @values_found_returned_table;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   317
			my @pattern_in_file_returned_table = fct_search_algo_4_pattern_in_file($package_path."\\".$file[$count],$pattern[$count],"/s /m");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   318
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   319
			# Display table in a nice way
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   320
			#display_array("files with pattern ".$pattern[$count],@pattern_in_file_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   321
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   322
			# Check if the key exists or not. If it doesn't exist then add it to the list
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   323
			@key_pattern_in_file_tab = add_key_for_dynamic_hash_array($pattern[$count], @key_pattern_in_file_tab);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   324
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   325
			# Used to verify if we have updated the table properly by replacing it with the table passed back
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   326
			#display_array("keys list after",@key_dirs_tab);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   327
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   328
			# Save table containing files list returned by fct in the hash array to key pattern pattern
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   329
			# hash array: pattern_in_file_hashes
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   330
			# contains a key called pattern_pattern1 ($pattern[$count]) which contains the table @dirs_returned_table that lists the directories found having for name directory_pattern1
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   331
			# contains a key called pattern_pattern2 ($pattern[$count]) which contains the table @dirs_returned_table that lists the directories found having for name directory_pattern2
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   332
			# Contain as many key as we are looking for directories
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   333
			foreach (@pattern_in_file_returned_table)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   334
			{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   335
				#print "Value: $_\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   336
				$pattern_in_file_hashes{$pattern[$count]}->{$_} = "";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   337
				#print "Value entered: <$pattern_in_file_hashes{$pattern[$count]}->{$_}>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   338
			}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   339
			#print "\nDump contain of hash array:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   340
			#print Dumper(\%pattern_in_file_hashes);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   341
			#print "Contain of hash array dumped\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   342
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   343
			# Hash array filling level 2 deepnees
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   344
			# Take keys (file) taken in the 1st level deepness of the file to do next search
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   345
			foreach my $path2file2look_into (sort keys %{$pattern_in_file_hashes{$pattern[$count]}} )
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   346
			{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   347
				print "path2file2look_into=<$path2file2look_into>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   348
				
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   349
				@values_found_returned_table = fct_search_algo_4_pattern_in_file($path2file2look_into,$pattern[$count],"/s");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   350
				#display_array("lines in <$path2file2look_into>",@values_found_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   351
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   352
				# Do we need to remove?????????:
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   353
				#	"I:\sf\os\kernelhwsrv\baseintegtests\baseintegrationtest\testsuites\sd\group\bld.inf:"
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   354
				# Keep only what is after ":" (not included)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   355
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   356
				# To remove????? - Beginning
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   357
#				my @pattern_in_file_cleanedup_table;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   358
#				my $local_string;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   359
#				$local_string = "\....:([\\w\\W]+)";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   360
#				print "local_string: $local_string\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   361
#				foreach my $line2transform (@values_found_returned_table)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   362
#				{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   363
#					print "line2transform: <$line2transform>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   364
#					$line2transform =~ /$local_string/;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   365
#					print "line2transformed: <$line2transform>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   366
#					push (@pattern_in_file_cleanedup_table,$line2transform);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   367
#				}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   368
				# To remove????? - End
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   369
				
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   370
				# Populate data in the hash array{pattern}{file}[(lines]	{key} - [table]
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   371
				$pattern_in_file_hashes{$pattern[$count]}->{$path2file2look_into} = \@values_found_returned_table;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   372
				# To remove????? - Beginning
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   373
				#$pattern_in_file_hashes{$pattern[$count]}->{$path2file2look_into} = \@pattern_in_file_cleanedup_table;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   374
				# To remove????? - End
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   375
			}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   376
			#print "\nDump full contain of hash array:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   377
			#print Dumper(\%pattern_in_file_hashes);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   378
			#print "Full contain of hash array dumped\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   379
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   380
			my $calcul_tab_size = scalar(@values_found_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   381
			if($calcul_tab_size)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   382
			{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   383
				print "There is data for this search: <$calcul_tab_size>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   384
				$existing_tests{$test_type[$count]}++;	# Add 1 to the count for the type of test supported
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   385
			}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   386
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   387
		case ($search_algo_4_directory)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   388
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   389
			print "Value is $search_algo_4_directory, meaning call fct_search_algo_4_directory\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   390
			my @dirs_returned_table = fct_search_algo_4_directory($directory[$count]);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   391
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   392
			# Display table in a nice way
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   393
			#display_array("directories ".$directory[$count],@dirs_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   394
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   395
			# Used to verify if table for the keys is managed properly
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   396
			#display_array("keys list before",@key_dirs_tab);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   397
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   398
			# Check if the key exists or not. If it doesn't exist then add it to the list
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   399
			@key_dirs_tab = add_key_for_dynamic_hash_array($directory[$count], @key_dirs_tab);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   400
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   401
			# Used to verify if we have updated the table properly by replacing it with the table passed back
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   402
			#display_array("keys list after",@key_dirs_tab);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   403
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   404
			# Save table containing directories list returned by fct in the hash array to key directory pattern
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   405
			# hash array: dirs_hashes
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   406
			# contains a key called directory_pattern1 ($directory[$count]) which contains the table @dirs_returned_table that lists the directories found having for name directory_pattern1
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   407
			# contains a key called directory_pattern2 ($directory[$count]) which contains the table @dirs_returned_table that lists the directories found having for name directory_pattern2
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   408
			# Contain as many key as we are looking for directories
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   409
			push (@{ $dirs_hashes{$directory[$count]} }, @dirs_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   410
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   411
			my $calcul_tab_size = scalar(@dirs_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   412
			if($calcul_tab_size)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   413
			{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   414
				print "There is data for this search: <$calcul_tab_size>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   415
				$existing_tests{$test_type[$count]}++;	# Add 1 to the count for the type of test supported
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   416
			}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   417
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   418
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   419
		case ($search_algo_4_pattern_anywhere_in_directory)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   420
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   421
			print "Value is $search_algo_4_pattern_anywhere_in_directory, meaning call fct_search_algo_4_pattern_anywhere_in_directory\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   422
			my @patterns_in_dir_returned_table = fct_search_algo_4_pattern_anywhere_in_directory($directory[$count],$pattern[$count]);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   423
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   424
			push (@{ $patterns_anywhere_in_dir_hashes{$pattern[$count]} }, @patterns_in_dir_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   425
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   426
			my $calcul_tab_size = scalar(@patterns_in_dir_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   427
			if($calcul_tab_size)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   428
			{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   429
				print "There is data for this search: <$calcul_tab_size>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   430
				$existing_tests{$test_type[$count]}++;	# Add 1 to the count for the type of test supported
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   431
			}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   432
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   433
		case ($search_algo_4_file_in_directory)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   434
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   435
			print "Value is $search_algo_4_file_in_directory, meaning call fct_search_algo_4_file_in_directory\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   436
			my @file_in_dir_returned_table = fct_search_algo_4_file_in_directory($directory[$count],$file[$count]);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   437
			#display_array("file <".$file[$count]."> in directory <".$directory[$count].">",@file_in_dir_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   438
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   439
			# Check if the key exists or not. If it doesn't exist then add it to the list
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   440
			@key_file_in_dir_tab = add_key_for_dynamic_hash_array($file[$count], @key_file_in_dir_tab);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   441
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   442
			#@key_file_in_dir_tab
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   443
			#%file_in_dir_hashes
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   444
			push (@{ $file_in_dir_hashes{$file[$count]} }, @file_in_dir_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   445
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   446
			print "\nDump full contain of hash array:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   447
			#print Dumper(\%file_in_dir_hashes);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   448
			print "Full contain of hash array dumped\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   449
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   450
			my $calcul_tab_size = scalar(@file_in_dir_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   451
			if($calcul_tab_size)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   452
			{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   453
				print "There is data for this search: <$calcul_tab_size>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   454
				$existing_tests{$test_type[$count]}++;	# Add 1 to the count for the type of test supported
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   455
			}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   456
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   457
		case ($search_algo_4_pattern_in_specific_file_directory)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   458
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   459
			print "Value is $search_algo_4_pattern_in_specific_file_directory, call fct_meaning search_algo_4_pattern_in_specific_file_directory\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   460
			my @patterns_in_dir_in_file_returned_table = fct_search_algo_4_pattern_in_specific_file_and_directory($directory[$count],$file[$count],$pattern[$count]);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   461
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   462
			push (@{ $patterns_in_dir_in_file_hashes{$pattern[$count]} }, @patterns_in_dir_in_file_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   463
			
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   464
			my $calcul_tab_size = scalar(@patterns_in_dir_in_file_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   465
			print "calcul_tab_size = <$calcul_tab_size>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   466
			if($calcul_tab_size)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   467
			{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   468
				print "There is data for this search: <$calcul_tab_size>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   469
				$existing_tests{$test_type[$count]}++;	# Add 1 to the count for the type of test supported
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   470
			}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   471
		}		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   472
		else
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   473
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   474
			# default for the switch
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   475
			# Added one for the line error as we need to add 1st line of the csv file, which is the header line
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   476
			print "No correct values was passed <$select_search_type>, which is impossible in our system!!! Error on line ". ($count+1). " of file $pattern_file_path\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   477
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   478
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   479
	$count++;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   480
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   481
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   482
# Output generated in a file which is following special naming convention because used to create the globabl picture
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   483
# pckg_test_atatus[pckgname].xml?
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   484
# Create file if doesn't exist. If exist already, update? delete & create from scratch?
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   485
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   486
# 1. Extract package name
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   487
# 2. Create a file called "package_test_status_[package_name].xml
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   488
# 3. Fill xml file using data gathered in this script
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   489
# 4. Close xml file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   490
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   491
print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   492
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   493
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   494
# Display data
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   495
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   496
print "!!!!This section is related to the display of the data gatehered by this script!!!!\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   497
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   498
# To remove????? - Beginning
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   499
#my @display_hash_tab;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   500
#@display_hash_tab = keys(%dirs_hashes);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   501
#foreach my $key_val (@display_hash_tab)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   502
#{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   503
#	print "Key: <$key_val>:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   504
#	my @read_table_in_hash_array = @{$dirs_hashes{$key_val}};
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   505
#	foreach my $tab_val (@read_table_in_hash_array)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   506
#	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   507
#		print "\tValue: <$tab_val>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   508
#	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   509
#}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   510
#print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   511
# To remove????? - End
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   512
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   513
# Display of the search we have done for the directories we need information from
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   514
if(%dirs_hashes)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   515
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   516
	print "Look for directories:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   517
	#display_hash_array_1_level_deep ("directories", %dirs_hashes);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   518
	print Dumper({%dirs_hashes});
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   519
	print "\n\n\t\t.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   520
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   521
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   522
# Display of the search we have done for the files we need information from
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   523
if(%files_hashes)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   524
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   525
	print "Look for files:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   526
	#display_hash_array_1_level_deep ("files", %files_hashes);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   527
	print Dumper({%files_hashes});
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   528
	print "\n\n\t\t.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   529
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   530
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   531
# Display of the search we have done for the pattern in files we need information from
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   532
if(%pattern_in_file_hashes)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   533
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   534
	print "Look for pattern in a file:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   535
	#display_hash_array_2_levels_deep ("1st & 2nd levels of patterns (files & lines) in files", %pattern_in_file_hashes);	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   536
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   537
	print Dumper(\%pattern_in_file_hashes);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   538
	#print Dumper({%pattern_in_file_hashes});	# same result as above
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   539
	print "\n\n\t\t.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   540
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   541
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   542
# Display of the search we have done for the files we need information from
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   543
if(%file_in_dir_hashes)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   544
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   545
	print "Look for files in a specific directory:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   546
	#display_hash_array_1_level_deep ("specific file in a specific directory", %file_in_dir_hashes);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   547
	print Dumper({%file_in_dir_hashes});
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   548
	print "\n\n\t\t.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   549
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   550
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   551
# Display of the search we have done for the patterns anywhere in directory / file names and in the files themselves.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   552
if(%patterns_anywhere_hashes)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   553
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   554
	print "Look for a pattern everywhere:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   555
	print Dumper({%patterns_anywhere_hashes});
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   556
	print "\n\n\t\t.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   557
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   558
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   559
# Display of the search we have done for the patterns anywhere in a specific directory.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   560
if(%patterns_anywhere_in_dir_hashes)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   561
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   562
	print "Look for a pattern everywhere in a directory:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   563
	print Dumper({%patterns_anywhere_in_dir_hashes});
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   564
	print "\n\n\t\t.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   565
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   566
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   567
# Display of the search we have done for the patterns in a specific directory that contain a specific file in that directory/sub-directory.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   568
if(%patterns_in_dir_in_file_hashes)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   569
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   570
	print "Look for a pattern in a specific file in a specific directory:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   571
	print Dumper({%patterns_in_dir_in_file_hashes});
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   572
	print "\n\n\t\t.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   573
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   574
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   575
print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   576
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   577
print "Indicates the type of tests supported by the package $pckg_name:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   578
print Dumper(\%existing_tests);	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   579
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   580
print "\n\n\t\t.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   581
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   582
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   583
# Save data in files
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   584
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   585
print "!!!!This section is related to the saving of the data in files!!!!\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   586
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   587
print "Save basic data about the type of tests supported by the package in a generic csv file\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   588
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   589
my $csv_status_file_path = "$publication_directory_path\\$csv_status_file_name";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   590
print "The full path for the csv packages tests status file is: $csv_status_file_path\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   591
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   592
if(!(-f $csv_status_file_path))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   593
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   594
	print "The file doesn't exist, we need to create it and fill it with the hearder row\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   595
	open(CSVSTATUSFILE,">$csv_status_file_path");	# Create the file from scratch
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   596
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   597
	print CSVSTATUSFILE "Package_Name";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   598
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   599
	foreach my $type_test_key (sort keys %existing_tests)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   600
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   601
		# Fields separated by comas
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   602
		print "Enter header name: type_test_key is $type_test_key\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   603
		print CSVSTATUSFILE ",$type_test_key";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   604
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   605
	print CSVSTATUSFILE "\n";	# To make sure we are ready for the next line
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   606
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   607
else
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   608
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   609
	print "The file exists, we need to populate it with the necessary info\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   610
	open(CSVSTATUSFILE,">>$csv_status_file_path");	# Append the file as it exists already and we are just going to add a new line
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   611
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   612
	# Do we need to check if we have the same number of info on the header row (1st row)?????
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   613
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   614
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   615
print CSVSTATUSFILE "$pckg_name";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   616
foreach my $type_test_key4val (sort keys %existing_tests)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   617
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   618
	# Fields separated by comas
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   619
	print "$pckg_name: The key test type is: <$type_test_key4val> and the value associated with is: <$existing_tests{$type_test_key4val}>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   620
	print CSVSTATUSFILE ",$existing_tests{$type_test_key4val}";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   621
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   622
print CSVSTATUSFILE "\n";	# To make sure we are ready for the next line
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   623
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   624
close(CSVSTATUSFILE);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   625
print "We have now updated the file <$csv_status_file_path> with the data gathered for the package $pckg_name\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   626
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   627
my $output_file_name = $output_file_base_name.$pckg_name.$output_file_extension;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   628
print "The output file name is: $output_file_name\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   629
my $path4output_file = "$publication_directory_path\\$output_file_name";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   630
print "The full path for the output file is: $path4output_file\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   631
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   632
print "\nCreate and fill file <$path4output_file>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   633
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   634
# Should we create a function that will be called form the switch/case that will save the info directly in the appropriate xml file and / or csv file?
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   635
open(OUTPUTFILE,">$path4output_file");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   636
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   637
print "Fill the xml file with data we have gathered in this script!!!!!\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   638
print OUTPUTFILE "Fill the xml file with data we have!!!!!\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   639
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   640
close (OUTPUTFILE);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   641
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   642
# End of the script
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   643
exit(0);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   644
# THE END OF THE END AT THE END OF THIS SCRIPT
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   645
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   646
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   647
# Functions section
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   648
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   649
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   650
# If no parameters entered or help selected, display help
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   651
sub helpme
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   652
{	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   653
	print "\nfct: helpme\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   654
	print "check_pckg_test_status.pl\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   655
	print "Usage:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   656
	print "check_pckg_test_status.pl --help\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   657
	print "check_pckg_test_status.pl --package_path=I:\\sf\\os\\kernelhwsrv --pattern_file_path=I:\\pckg_test_status_patterns.txt --publication_directory_path=I:\\results\\kernelhwsrv\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   658
	print "Options:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   659
	print "--help:\t\t\t\t display this help and exit\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   660
	print "--package_path:\t\t\t is the path to the directory containing the package_definition.xml file\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   661
	print "--pattern_file_path:\t\t is the path to the file containing the patterns to be lookeed for\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   662
	print "--publication_directory_path:\t is the path to the directory where the results will be published\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   663
	print "\t\t\t\t default value is $default_publication_directory_path\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   664
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   665
	exit(0);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   666
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   667
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   668
# Search functions
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   669
sub fct_search_algo_4_pattern_anywhere
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   670
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   671
	my ($pattern) = @_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   672
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   673
	print "This is the function: fct_search_algo_4_pattern_anywhere\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   674
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   675
	print "Search for pattern: <$pattern>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   676
	my @pattern_search_tab;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   677
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   678
	# Firstly have a look for the pattern in the directories and files names
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   679
	print "Search for the pattern in any directory or file names\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   680
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   681
	@pattern_search_tab = fct_dos_cmd_dir_search("$package_path\\*$pattern*", "/s /b");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   682
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   683
	#print "Pattern <$pattern> was found in: @pattern_search_tab\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   684
	#print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   685
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   686
	# Secondly have a look in any files if we can find the pattern.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   687
	# Should we use: fct_search_algo_4_pattern_in_file()?
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   688
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   689
	my @local_returned_table = fct_search_algo_4_pattern_in_file($package_path . "\\*",$pattern[$count],"/s /n");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   690
	# If we just want to display the files and not the contain of the line. As well should elimintate the duplicate for files?
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   691
	#my @local_returned_table = fct_search_algo_4_pattern_in_file($local_package_path,$pattern[$count],"/s /m");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   692
	push(@pattern_search_tab,@local_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   693
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   694
	#print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   695
	#print "Pattern <$pattern> was found in: @pattern_search_tab\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   696
	#print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   697
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   698
	return (@pattern_search_tab);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   699
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   700
sub fct_search_algo_4_file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   701
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   702
	my ($file) = @_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   703
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   704
	print "This is the function: fct_search_algo_4_file\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   705
	print "Search for file: <$file>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   706
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   707
	my @files;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   708
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   709
	@files = fct_dos_cmd_dir_search("$package_path\\$file", "/s /b");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   710
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   711
	#print "files found are: @files\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   712
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   713
	print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   714
	return (@files);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   715
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   716
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   717
# This function was originally setup to have a look for a pattern in a specific files,
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   718
# but we can do a search in a directory by adding \\* at the end of the path, which will be like look in all the files in the directory and sub-directories.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   719
sub fct_search_algo_4_pattern_in_file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   720
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   721
	my ($file,$pattern,$options) = @_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   722
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   723
	print "This is the function: fct_search_algo_4_pattern_in_file\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   724
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   725
	#print "Search for file: <$file>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   726
	#print "Search for pattern: <$pattern>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   727
	#print "Options: <$options>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   728
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   729
	my @pattern_in_files;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   730
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   731
	# Check findstr /? to find out about the "regular expression"
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   732
	# "." Wildcard: any character
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   733
	# "*" Repeat: zero or more occurances of previous character or class
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   734
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   735
	# Check if the pattern contain a dot. If yes replace any "." by "\."
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   736
	if ( $pattern =~ /\./)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   737
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   738
		$pattern =~ s/\./\\./;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   739
		#print "Replaced all \. by \\. to the pattern: <$pattern>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   740
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   741
	else
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   742
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   743
		#print "$pattern doesn't doesn't contain a \.\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   744
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   745
	# Check if the pattern contain a star. If yes replace any "*" by ".*"
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   746
	# For a string to have a look at "string*.txt", the "*" equivalent for findstr is ".*"
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   747
	# For more info, check out here: http://technet.microsoft.com/en-us/library/bb490907.aspx
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   748
	if ( $pattern =~ /\*/)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   749
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   750
		$pattern =~ s/\*/\.\*/g;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   751
		#print "Replaced all \* by \.* to the pattern: <$pattern>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   752
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   753
	else
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   754
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   755
		#print "$pattern doesn't contain a *\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   756
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   757
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   758
	# If the pattern contains a starting " and and end ", we consider we are looking for a the full string included between "" and therefore we need to use the option /c:"pattern to look for"
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   759
	if ( ($pattern =~ /^"/) && ($pattern =~ /"$/))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   760
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   761
		# Replace the first <"> by </c:">
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   762
		$pattern =~ s/\"/\/c:\"/;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   763
		#print "Replaced first <\"> by <\/c:\"> to become: <$pattern>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   764
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   765
	else
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   766
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   767
		#print "$pattern is not contained between\"\" \n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   768
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   769
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   770
	open(SEARCHPATTERNINFILE,"findstr $options $pattern $file |");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   771
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   772
	while(<SEARCHPATTERNINFILE>)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   773
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   774
		my $val = $_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   775
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   776
		#remove the trailing \n
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   777
		chomp($val);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   778
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   779
		#print "value found is <$val>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   780
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   781
		if($val =~ /.hg/)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   782
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   783
			#print "Discard that line!\n"
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   784
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   785
		else
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   786
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   787
			#print "We need to save the value <$val>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   788
			# Push value in a table and pass it as a parameter!?
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   789
			push(@pattern_in_files,$val);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   790
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   791
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   792
	close(SEARCHPATTERNINFILE);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   793
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   794
	print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   795
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   796
	return (@pattern_in_files);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   797
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   798
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   799
sub fct_search_algo_4_directory
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   800
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   801
	#my $dir = $_[0]; # get first argument passed to the function
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   802
	my ($dir) = @_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   803
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   804
	print "This is the function: fct_search_algo_4_directory\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   805
	print "Search for directory: <$dir>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   806
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   807
	my @dirs;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   808
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   809
	# To remove????? - Beginning
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   810
	#opendir DIR, $package_path or die "can't read $package_path: $!";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   811
	#@dirs = readdir DIR;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   812
	#@dirs = dir "$dir", readdir DIR;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   813
	#closedir DIR;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   814
	#print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   815
	#print @dirs;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   816
	#print "\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   817
	# To remove????? - End
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   818
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   819
	@dirs = fct_dos_cmd_dir_search("$package_path\\$dir", "/s /b /a:d");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   820
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   821
	# To remove????? - Beginning
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   822
	if(scalar(@dirs))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   823
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   824
		#print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   825
		#print "Here is the list of directories that we have found named <$dir>:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   826
		foreach (@dirs)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   827
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   828
			#print "\t$_\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   829
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   830
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   831
	#print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   832
	# To remove????? - End
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   833
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   834
	return (@dirs);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   835
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   836
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   837
sub fct_search_algo_4_pattern_anywhere_in_directory
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   838
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   839
	my ($dir,$pattern) = @_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   840
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   841
	print "This is the function: fct_search_algo_4_pattern_anywhere_in_directory\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   842
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   843
	print "Findout if there is one or more directory called: <$dir>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   844
	my @local_dir_exist_tab;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   845
	my @table_to_return_with_search;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   846
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   847
	@local_dir_exist_tab = fct_dos_cmd_dir_search("$package_path\\$dir", "/s /b /a:d");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   848
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   849
	print "we found <$dir>: \n<\n@local_dir_exist_tab \n>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   850
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   851
	print "Search for pattern: <$pattern> in directory $dir\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   852
	foreach my $dir_to_search (@local_dir_exist_tab)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   853
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   854
		print "The directory that we examine is: $dir_to_search\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   855
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   856
		my @local_pattern_in_directory_returned_table = fct_search_algo_4_pattern_in_file($dir_to_search. "\\*",$pattern,"/s /n");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   857
		push(@table_to_return_with_search,@local_pattern_in_directory_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   858
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   859
		#print "Here are all the values we found for $pattern in $dir_to_search:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   860
		#print Dumper(@local_pattern_in_directory_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   861
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   862
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   863
	#print "Here are all the values we found and that will be returned: \n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   864
	#print Dumper(@table_to_return_with_search);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   865
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   866
	print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   867
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   868
	return (@table_to_return_with_search);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   869
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   870
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   871
sub fct_search_algo_4_file_in_directory
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   872
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   873
	my ($dir,$file) = @_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   874
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   875
	print "This is the function: fct_search_algo_4_file_in_directory\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   876
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   877
	print "Search for directory: <$dir>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   878
	print "Search for file: <$file>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   879
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   880
	print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   881
	my @dir_list;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   882
	my @file_in_dir;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   883
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   884
	print "Look for directories <$dir>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   885
	@dir_list = fct_dos_cmd_dir_search("$package_path\\$dir", "/s /b /a:d");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   886
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   887
	#print "we found <$dir>: \n<\n@dir_list \n>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   888
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   889
	# Look for files in the directories we have previously found
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   890
	print "Look for the file <$file> in the directory found previously\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   891
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   892
	foreach my $dir_to_search (@dir_list)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   893
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   894
		#print "Look file <$file> in directory <$dir_to_search>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   895
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   896
		@file_in_dir = fct_dos_cmd_dir_search("$dir_to_search\\$file", "/s /b");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   897
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   898
		open(SEARCHFILEDIR,"dir /s /b $dir_to_search\\$file |");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   899
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   900
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   901
	#print "we found <$file> in: \n<\n@file_in_dir \n>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   902
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   903
	return (@file_in_dir);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   904
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   905
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   906
sub fct_search_algo_4_pattern_in_specific_file_and_directory
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   907
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   908
	my ($dir,$file,$pattern) = @_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   909
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   910
	print "This is the function: fct_search_algo_4_pattern_in_specific_file_and_directory\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   911
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   912
	my @local_dir_exist_tab;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   913
	my @local_file_exist_in_dir_tab;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   914
	my @table_to_return_with_search;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   915
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   916
	# Look for directories
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   917
	print "Look for directories <$dir>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   918
	@local_dir_exist_tab = fct_dos_cmd_dir_search("$package_path\\$dir", "/s /b /a:d");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   919
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   920
	#print "we found <$dir>: \n<\n@local_dir_exist_tab \n>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   921
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   922
	# Look for files in the directories we have previously found
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   923
	print "Look for the file <$file> in the directory found previously\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   924
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   925
	foreach my $dir_to_search (@local_dir_exist_tab)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   926
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   927
		#print "Look file <$file> in directory <$dir_to_search>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   928
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   929
		@local_file_exist_in_dir_tab = fct_dos_cmd_dir_search("$dir_to_search\\$file", "/s /b");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   930
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   931
		open(SEARCHFILEDIR,"dir /s /b $dir_to_search\\$file |");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   932
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   933
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   934
	#print "we found <$file> in: \n<\n@local_file_exist_in_dir_tab \n>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   935
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   936
	print "Search for pattern: $pattern in directory $dir and file $file\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   937
	foreach my $file_to_search (@local_file_exist_in_dir_tab)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   938
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   939
		#print "File to examine is: $file_to_search\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   940
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   941
		my @local_pattern_in_file_returned_table = fct_search_algo_4_pattern_in_file($file_to_search,$pattern,"/s /n");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   942
		push(@table_to_return_with_search,@local_pattern_in_file_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   943
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   944
		#print "Here are all the values we found for $pattern in $file_to_search:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   945
		#print Dumper(@local_pattern_in_file_returned_table);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   946
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   947
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   948
	#print "Here are all the values we found and that will be returned: \n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   949
	#print Dumper(@table_to_return_with_search);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   950
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   951
	print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   952
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   953
	return (@table_to_return_with_search);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   954
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   955
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   956
# create a function that will look for a file or directory
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   957
sub fct_dos_cmd_dir_search
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   958
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   959
	my ($what_to_look_for,$options) = @_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   960
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   961
	print "This is the function: fct_dos_cmd_dir_search\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   962
	my @search_result_tab;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   963
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   964
	print "what_to_look_for: <$what_to_look_for>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   965
	print "options: <$options>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   966
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   967
	open(SEARCHUSINGDIRDOSCMD,"dir $options $what_to_look_for |");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   968
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   969
	while(<SEARCHUSINGDIRDOSCMD>)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   970
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   971
		my $val = $_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   972
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   973
		#remove the trailing \n
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   974
		chomp($val);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   975
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   976
		#print "value found is <$val>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   977
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   978
		if($val =~ /.hg/)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   979
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   980
			#print "Discard that line!\n"
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   981
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   982
		else
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   983
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   984
			#print "We need to save the value <$val>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   985
			# Push value in a table and pass it as a parameter!?
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   986
			push(@search_result_tab,$val);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   987
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   988
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   989
	close(SEARCHUSINGDIRDOSCMD);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   990
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   991
	return (@search_result_tab);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   992
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   993
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   994
# Display an array with text indicating what it is
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   995
sub display_array
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   996
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   997
	# It is important to pass variable first then table, otherwise if variable comes second, you can't find it using @_. Why?
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   998
	my ($what_is_it,@table2display) = @_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   999
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1000
	#print "what_is_it: <$what_is_it>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1001
	print "The table containing all the ". $what_is_it ." is:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1002
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1003
	foreach (@table2display)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1004
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1005
		print "\t".$_."\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1006
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1007
	print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1008
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1009
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1010
# Display a 1 level deep hash array in a nice way
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1011
sub display_hash_array_1_level_deep
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1012
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1013
	# It is important to pass variable first then table, otherwise if variable comes second, you can't find it using @_. Why?
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1014
	my ($what_is_it,%hash_array2display) = @_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1015
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1016
	print "The hash array containing all the ". $what_is_it ." is:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1017
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1018
	foreach my $k (keys %hash_array2display)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1019
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1020
	   print "$k:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1021
	   foreach (@{$hash_array2display{$k}})
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1022
	   {
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1023
		  print "\t$_\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1024
	   }
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1025
	   print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1026
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1027
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1028
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1029
# Display a 2 levels deep hash array in a nice way
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1030
sub display_hash_array_2_levels_deep
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1031
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1032
	# It is important to pass variable first then table, otherwise if variable comes second, you can't find it using @_. Why?
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1033
	my ($what_is_it,%hash_array2display) = @_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1034
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1035
	print "The hash array containing all the ". $what_is_it ." is:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1036
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1037
	foreach my $k1 ( sort keys %hash_array2display )
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1038
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1039
		print "$k1\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1040
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1041
        foreach my $k2 ( sort keys %{$hash_array2display{ $k1 }} )
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1042
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1043
            print "\t$k2\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1044
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1045
            foreach my $k3 ( @{$hash_array2display{ $k1 }->{ $k2 }} )
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1046
			{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1047
				print "\t\t$k3\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1048
            }
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1049
        }
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1050
    }
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1051
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1052
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1053
# Add new key to table if the key is not already present in the table
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1054
sub add_key_for_dynamic_hash_array
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1055
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1056
	my ($key2look4,@table2look_into) = @_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1057
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1058
	#print "Nb of pattern keys in table2look_into is:<".scalar(@table2look_into).">\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1059
	if(!scalar(@table2look_into))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1060
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1061
		#print "No keys in the table right now. Add <$directory[$count]> as a new key\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1062
		push (@table2look_into,$key2look4);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1063
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1064
	#print "table2look_into:\n\t@table2look_into\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1065
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1066
	my $counter_found_key=0;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1067
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1068
	foreach my $local_var(@table2look_into)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1069
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1070
		#print "local_var= <$local_var>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1071
		if($key2look4 eq $local_var)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1072
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1073
			#print "That key exists already\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1074
			$counter_found_key++;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1075
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1076
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1077
	#print "counter_found_key=$counter_found_key\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1078
	if(!$counter_found_key)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1079
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1080
		#print "The key <$directory[$count]> has not be found in the list\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1081
		# Save key in the table to detect if exit or not
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1082
		push (@table2look_into,$key2look4);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1083
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1084
	return (@table2look_into);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1085
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1086
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
  1087
# End section related to help