1
# LSB Test Execution Framework
2
# Module for Generating Lists of Tests (BuildList.pm)
4
# Copyright (C) 2007-2009 The Linux Foundation. All rights reserved.
6
# This program has been developed by ISP RAS for LF.
7
# The ptyshell tool is originally written by Jiri Dluhos <jdluhos@suse.cz>
8
# Copyright (C) 2005-2007 SuSE Linux Products GmbH
10
# This program is free software; you can redistribute it and/or
11
# modify it under the terms of the GNU General Public License
12
# version 2 as published by the Free Software Foundation.
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
19
# You should have received a copy of the GNU General Public License
20
# along with this program; if not, write to the Free Software
21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
32
@BuildList::ISA = 'Exporter';
33
@BuildList::EXPORT = (
39
&generate_std_profiles
40
&generate_js_init_data
41
&generate_profile_init
46
# $manifest: reference to the hash containing Manifest data
49
# List of error messages
50
our @buildlist_errors = ();
52
# Supported architectures
55
our @all_std_versions;
57
# %tests_tree: Categorized list of tests
58
# {std_version => {category => {'SUBCAT' => {subcategory => {'TESTS' => [test1, test2, ...] } } } } }
61
# Builds the tree of tests from manifest data
62
sub build_tests_tree() {
63
@buildlist_errors = ();
66
push @buildlist_errors, 'Manifest not defined!';
69
foreach my $stdv (keys %{$manifest->{'TREE'}}) {
70
$tests_tree{$stdv} = {} if (!exists($tests_tree{$stdv}));
71
foreach my $ts (keys %{$manifest->{'TREE'}->{$stdv}}) {
72
my @path_elems = split(m/\//, $manifest->{'TREE'}->{$stdv}->{$ts});
73
my $root = $tests_tree{$stdv};
75
while ($elem = shift @path_elems) {
76
$elem =~ s/^<(.*)>$/$1/;
77
$root->{$elem} = {} if (!exists($root->{$elem}));
78
if (scalar(@path_elems) > 0) {
79
$root->{$elem}->{'SUBCAT'} = {} if (!exists($root->{$elem}->{'SUBCAT'}));
80
$root = $root->{$elem}->{'SUBCAT'};
83
$root->{$elem}->{'TESTS'} = [] if (!exists($root->{$elem}->{'TESTS'}));
84
$root = $root->{$elem}->{'TESTS'};
92
# Arrays for extended sorting:
93
# test suite categories
94
my @tests_tree_sort1 = ('Certification Tests', 'Unofficial Tests');
95
# test suite subcategories
96
my @tests_tree_sort2 = ('Command Tests', 'Static Interface Tests', 'Runtime Interface Tests', 'Automated Application Battery Tests', 'Manual Tests');
97
# preferrable test suite status
98
my @preferred_status_list = ('cert', 'certold', 'noncert', 'beta', 'snapshot');
101
# PUBLIC: Generates HTML code with list of test suites, versions, etc.
102
sub generate_modlist() {
103
@buildlist_errors = ();
105
push @buildlist_errors, 'Manifest not defined!';
109
foreach my $arch (@supported_archs) {
110
foreach my $stdv (@all_std_versions) {
114
$res .= " <table id=\"arch-$arch-$stdv_id\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: solid 4px white; width: 100%; display: none;\">\n";
116
<tr class="list_head">
117
<td style="width: 14.5em;"><input type="checkbox" name="check-all-$arch-$stdv_id" id="check-all-$arch-$stdv_id" onclick="javascript:un_check_all('all');" /></td>
118
<td style="width: 7.5em; padding-left: 1em;"><span class="clickable" onclick="javascript:selectVersionAll(this); return false;" title="Select versions"><b>Version</b></span></td>
119
<td style="width: 1em;"><img src="images/environment-spacer.gif" alt="" style="width: 1em;" /></td>
120
<td style="width: 5em;"><span class="clickable" onclick="javascript:fileOptionsAll(this);" title="Select installation method"><b>Files</b></span></td>
121
<td style="width: 1em;"><img src="images/environment-spacer.gif" alt="" style="width: 1em;" /></td>
122
<td style="width: 5em;"><span class="clickable" onclick="javascript:customizeAll(this);" title="Select installation method"><b>Advanced</b></span></td>
127
foreach my $disp_name1 (sort { sort_cat($a, $b, \@tests_tree_sort1); } keys %{$tests_tree{$stdv}}) {
128
my $int_name1 = lc($disp_name1);
129
$int_name1 =~ s/ /_/g;
131
<tr class="list_cat">
132
<td colspan="7"><b><label><input type="checkbox" name="check-$int_name1-$arch-$stdv_id" id="check-$int_name1-$arch-$stdv_id" onclick="javascript:un_check_all('$int_name1');" /> $disp_name1</label> <span class="active" onclick="javascript:show_hide_tooltip(this, '$int_name1', event);"><img src="images/question.png" width="16" height="17" alt="[?]" title="What's this?" /></span></b></td>
135
foreach my $disp_name2 (sort { sort_cat($a, $b, \@tests_tree_sort2); } keys %{$tests_tree{$stdv}->{$disp_name1}->{'SUBCAT'}}) {
136
my $int_name2 = lc($disp_name2);
137
$int_name2 =~ s/ /_/g;
139
<tr class="list_subcat">
140
<td colspan="7"><b><label><input type="checkbox" name="check-$int_name1-$int_name2-$arch-$stdv_id" id="check-$int_name1-$int_name2-$arch-$stdv_id" onclick="javascript:un_check_all('$int_name1-$int_name2');" /> $disp_name2</label> <span class="active" onclick="javascript:show_hide_tooltip(this, '$int_name1-$int_name2', event); return false;"><img src="images/question.png" width="16" height="17" alt="[?]" title="What's this?" /></span></b></td>
144
foreach my $int_name3 (sort @{$tests_tree{$stdv}->{$disp_name1}->{'SUBCAT'}->{$disp_name2}->{'TESTS'}}) {
145
push @ts_list, $int_name3;
146
$row_color = 1 - $row_color;
147
my $mod_descr = $manifest->{'DESCRIPTIONS'}->{$int_name3};
148
my $disp_name3 = $int_name3;
149
my ($descr_obj) = grep { version_filter($_->{'STANDARD'}, $stdv) } @$mod_descr;
151
$disp_name3 = $descr_obj->{'DISPLAYNAME'};
153
my $status_list = $manifest->{'COMPOSITION'}->{$stdv}->{$int_name3}->{$arch};
158
$status = (sort { sort_cat($a, $b, \@preferred_status_list); } keys %$status_list)[0];
159
$version = (sort { vercmp($a, $b) } keys %{$status_list->{$status}})[0]
166
my $td_class = ($enabled ? 'dropdown' : 'dropdown_dis');
167
my $color = ($enabled ? 'black' : 'gray');
168
my $chkbox_state = ($enabled ? '' : '');
169
my $chkbox_handlers = ($enabled ? ' onclick="javascript:update_elements_state();" ondblclick="javascript:setTimeout(\'update_elements_state()\', 500);"' : ' disabled="disabled"');
170
my $statver_handlers = ($enabled ? ' onclick="javascript:selectVersion(this, \''.$int_name3.'\');"' : '');
171
my $files_handlers = ($enabled ? ' onclick="javascript:selectInstall(this, \''.$int_name3.'\');"' : '');
172
my $config_handlers = ($enabled ? ' onclick="javascript:customizeTS(this, \''.$int_name3.'\');"' : '');
173
my $files_img = ($enabled ? 'files_normal.png' : 'files_disabled.png');
174
my $config_img = ($enabled ? 'configure_answers.png' : 'configure_answers_dis.png');
175
my $id_suffix = ($enabled ? '' : '-dis');
177
<tr class="list_item$row_color">
178
<td><label><input type="checkbox" name="mod-$arch-$stdv_id-$int_name3$id_suffix" id="mod-$arch-$stdv_id-$int_name3$id_suffix"$chkbox_handlers /> <span style="color: $color;">$disp_name3</span></label></td>
179
<td class="$td_class"$statver_handlers><img src="images/status_$status.png" alt="" width="16" height="16" id="stat-$arch-$stdv_id-$int_name3$id_suffix" /> <span id="visver-$arch-$stdv_id-$int_name3$id_suffix">$version</span><img src="images/environment-spacer.gif" width="18" height="1" alt="" /><input type="hidden" name="ver-$arch-$stdv_id-$int_name3$id_suffix" id="ver-$arch-$stdv_id-$int_name3$id_suffix" value="$status|$version" /></td>
181
<td class="$td_class"$files_handlers><img src="images/$files_img" alt="" width="16" height="16" id="visinst-$arch-$stdv_id-$int_name3$id_suffix" /></td>
183
<td class="$td_class"$config_handlers><img src="images/$config_img" alt="" width="16" height="16" id="viscust-$arch-$stdv_id-$int_name3$id_suffix"/></td>
187
my $opt_list = $manifest->{'OPTIONS'}->{$int_name3};
189
my @glob_options = grep { $_->{'GLOBAL'} and version_filter($_->{'STANDARD'}, $stdv) } @$opt_list;
190
foreach my $option (@glob_options) {
191
foreach my $var (@{$option->{'VARIANTS'}}) {
192
my $check = (($var eq $option->{'DEFAULT'}) ? ' checked="checked"' : '');
194
$id =~ s/[^A-Za-z0-9\-_:\.]/-/g;
196
<tr class="list_item$row_color">
197
<td colspan="7"> <label><input type="radio" name="modopt-$arch-$stdv_id-$int_name3-$option->{'ID'}$id_suffix" id="modopt-$arch-$stdv_id-$int_name3-$option->{'ID'}-$id$id_suffix" value="$var"$check disabled="disabled" onclick="javascript:update_elements_state();" ondblclick="javascript:setTimeout('update_elements_state()', 500);" /> $option->{'DISPLAY'}->{$var}</label></td>
206
$res .= " </table>\n";
207
$res .= " <input type=\"hidden\" name=\"ts-sort-$arch-$stdv_id\" value=\"".join(';', @ts_list)."\" />\n";
213
# PUBLIC: Generates JS code for filling in the stdp_list array (list of profiles present in each standard version).
214
sub generate_std_profiles() {
215
@buildlist_errors = ();
216
my $res = "\tstdp_list = new Array();\n";
218
push @buildlist_errors, 'Manifest not defined!';
221
foreach my $stdv (sort keys %{$manifest->{'STD_PROFILES'}}) {
224
my $std_profile_list = $manifest->{'STD_PROFILES'}->{$stdv};
225
$res .= "\tstdp_list['$stdv_id'] = new Array();\n";
226
foreach my $id (sort keys %$std_profile_list) {
227
my $value = $std_profile_list->{$id};
228
$value =~ s/</</g;
229
$value =~ s/>/>/g;
230
$value =~ s/&/&/g;
231
$res .= "\tstdp_list['$stdv_id']['$id'] = '$value';\n";
237
# List of all the files used by all test suite versions.
240
# Generates JS code for filling in the ts_files array (info about test suite versions, files they use, etc.).
241
sub generate_ts_files() {
242
@buildlist_errors = ();
243
my $res = "\tts_files = new Array();\n";
245
push @buildlist_errors, 'Manifest not defined!';
248
foreach my $arch (@supported_archs) {
249
foreach my $stdv (@all_std_versions) {
252
$res .= "\tts_files['$arch-$stdv_id'] = new Array();\n";
253
my $test_list = $manifest->{'COMPOSITION'}->{$stdv};
254
foreach my $ts (keys %$test_list) {
255
$res .= "\tts_files['$arch-$stdv_id']['$ts'] = new Array();\n";
256
my $status_list = $test_list->{$ts}->{$arch};
257
foreach my $status (keys %$status_list) {
258
$res .= "\tts_files['$arch-$stdv_id']['$ts']['$status'] = new Array();\n";
259
my $ver_list = $status_list->{$status};
260
foreach my $ver (keys %$ver_list) {
262
foreach my $pkg (@{$ver_list->{$ver}}) {
263
my $pkg_manager = 'rpm';
264
my $files = select_file($manifest, $arch, $pkg_manager, $pkg->{'PACKAGE'}, $pkg->{'PACKAGE_VER'}, $pkg->{'LOCATION'});
265
if (!is_ok($files)) {
266
push @buildlist_errors, $Error::Last->tostring();
267
push @buildlist_errors, "Internal error: file not found for $pkg_manager/$arch/$stdv/$ts/$status/$ver (".$pkg->{'PACKAGE'}."-".$pkg->{'PACKAGE_VER'}."@".$pkg->{'LOCATION'}.")!";
270
if (scalar(@$files) > 1) {
271
push @buildlist_errors, "Internal error: too many files for $pkg_manager/$arch/$stdv/$ts/$status/$ver (".$pkg->{'PACKAGE'}."-".$pkg->{'PACKAGE_VER'}."@".$pkg->{'LOCATION'}.")!";
273
my $fname = $files->[0]->{'SRC'}.'/'.$files->[0]->{'FILENAME'};
274
push @fpaths, "'".$fname."'";
275
push @used_files, $fname;
278
$res .= "\tts_files['$arch-$stdv_id']['$ts']['$status']['$ver'] = new Array(".join(", ", @fpaths).");\n";
284
$res .= "\n\tbuild_file_ts();\n";
288
# Generates JS code for filling in the mod_time array (info about test suite estimated execution time).
289
sub generate_ts_times() {
290
return "\tmod_time = new Array();\n";
293
# Generates JS code for filling in the file_size_full and file_size_disk arrays (sizes of files: remote and in cache).
294
# Needs @used_files to be filled by generate_ts_files() call!
295
sub generate_file_sizes() {
296
@buildlist_errors = ();
297
my $res = "\tfile_size = new Array();\n\tfile_downloaded = new Array();\n\tfile_installed = new Array();\n\tfile_size[''] = 0;\n";
299
push @buildlist_errors, 'Manifest not defined!';
302
if (scalar(@used_files) == 0) {
303
push @buildlist_errors, 'List of files is empty (generate_ts_files() not called)!';
306
foreach my $file (@used_files) {
307
$res .= "\tfile_size['$file'] = ".$manifest->{'FILES'}->{$file}->{'SIZE'}.";\n";
308
$res .= "\tfile_downloaded['$file'] = ".$manifest->{'FILES'}->{$file}->{'DOWNLOADED'}.";\n";
309
if ($manifest->{'FILES'}->{$file}->{'KIND'} eq 'file') {
310
$res .= "\tfile_installed['$file'] = -1;\n";
313
my $pkg = $manifest->{'FILES'}->{$file}->{'PACKAGE'};
314
my $ver = $manifest->{'FILES'}->{$file}->{'VERSION'};
315
$res .= "\tfile_installed['$file'] = ".($manifest->{'PACKAGES'}->{$pkg}->{'VERSIONS'}->{$ver} ? '1' : '0').";\n";
321
sub generate_ts_options() {
322
@buildlist_errors = ();
323
my $res = "\tts_options = new Array();\n";
325
push @buildlist_errors, 'Manifest not defined!';
328
foreach my $arch (@supported_archs) {
329
foreach my $stdv (@all_std_versions) {
332
$res .= "\tts_options['$arch-$stdv_id'] = new Array();\n";
333
foreach my $ts (keys %{$manifest->{'TREE'}->{$stdv}}) {
335
my $opt_list = $manifest->{'OPTIONS'}->{$ts};
337
my @options = grep { $_->{'GLOBAL'} and version_filter($_->{'STANDARD'}, $stdv) } @$opt_list;
338
$id_list = join(', ', map { "'$_->{'ID'}'" } @options);
340
$res .= "\tts_options['$arch-$stdv_id']['$ts'] = new Array($id_list);\n";
347
# Generates JS code for filling in the ts_expect_info array (autoreplies to test suite questions).
348
sub generate_ts_expect_info() {
349
@buildlist_errors = ();
350
my $res = "\tts_expect_info = new Array();\n";
352
push @buildlist_errors, 'Manifest not defined!';
355
foreach my $arch (@supported_archs) {
356
foreach my $stdv (@all_std_versions) {
359
$res .= "\tts_expect_info['$arch-$stdv_id'] = new Array();\n";
360
my $test_list = $manifest->{'COMPOSITION'}->{$stdv};
361
foreach my $ts (keys %$test_list) {
362
$res .= "\tts_expect_info['$arch-$stdv_id']['$ts'] = new Array();\n";
363
my $status_list = $test_list->{$ts}->{$arch};
364
foreach my $status (keys %$status_list) {
365
$res .= "\tts_expect_info['$arch-$stdv_id']['$ts']['$status'] = new Array();\n";
366
my $ver_list = $status_list->{$status};
367
foreach my $ver (keys %$ver_list) {
368
$res .= "\tts_expect_info['$arch-$stdv_id']['$ts']['$status']['$ver'] = new Array();\n";
369
my $opt_list = $manifest->{'OPTIONS'}->{$ts};
371
my @options = grep { !$_->{'GLOBAL'} and version_filter($_->{'STANDARD'}, $stdv) and version_filter($_->{'TEST_VER'}, $ver) } @$opt_list;
372
foreach my $option (@options) {
373
my $def_answer = (defined($option->{'DEFAULT'}) ? $option->{'DEFAULT'} : '[default]');
374
$res .= "\tts_expect_info['$arch-$stdv_id']['$ts']['$status']['$ver']['$option->{'ID'}'] = {question: '$option->{'Q'}', def_answer: '$def_answer', answer: '$def_answer'};\n";
385
# Generates JS code for filling in the mod_cat_list array (test suites to be selected on checking a category)
386
# and in the check_list array (subcategories to be selected on checking a category).
387
sub generate_mod_cat_list_check_list() {
388
@buildlist_errors = ();
389
my $res_m = "\tmod_cat_list = new Array();\n";
390
my $res_c = "\tcheck_list = new Array();\n";
392
push @buildlist_errors, 'Manifest not defined!';
393
return "$res_m\n$res_c";
395
foreach my $arch (@supported_archs) {
396
foreach my $stdv (@all_std_versions) {
399
$res_m .= "\tmod_cat_list['$arch-$stdv_id'] = new Array();\n";
400
$res_c .= "\tcheck_list['$arch-$stdv_id'] = new Array();\n";
401
my %mod_list = ('all' => {});
402
my %cat_list = ('all' => {});
403
foreach my $cat (keys %{$tests_tree{$stdv}}) {
404
my $cat_id = lc($cat);
406
$cat_list{'all'}->{$cat_id} = 1;
407
foreach my $subcat (keys %{$tests_tree{$stdv}->{$cat}->{'SUBCAT'}}) {
408
my $subcat_id = lc($subcat);
409
$subcat_id =~ s/ /_/g;
410
$subcat_id = "$cat_id-$subcat_id";
411
$cat_list{'all'}->{$subcat_id} = 1;
412
$cat_list{$cat_id}->{$subcat_id} = 1;
413
foreach my $ts (@{$tests_tree{$stdv}->{$cat}->{'SUBCAT'}->{$subcat}->{'TESTS'}}) {
414
$mod_list{'all'}->{$ts} = 1;
415
$mod_list{$cat_id}->{$ts} = 1;
416
$mod_list{$subcat_id}->{$ts} = 1;
420
foreach my $cat (sort keys %mod_list) {
421
$res_m .= "\tmod_cat_list['$arch-$stdv_id']['$cat'] = new Array(".join(', ', map("'$_'", keys %{$mod_list{$cat}})).");\n";
423
foreach my $cat (sort keys %cat_list) {
424
$res_c .= "\tcheck_list['$arch-$stdv_id']['$cat'] = new Array(".join(', ', map("'$_'", keys %{$cat_list{$cat}})).");\n";
428
return "$res_m\n$res_c";
431
# PUBLIC: Generates JS code for initializing all the necessary structures at once.
432
sub generate_js_init_data() {
433
return "\tarch_list = new Array(".join(', ', map("'$_'", @supported_archs)).");\n" .
434
"\tstdv_list = new Array(".join(', ', map { my $tmp = $_; $tmp =~ s/ /:/g; "'$tmp'" } @all_std_versions).");\n" .
435
"\tmod_list = new Array(".join(', ', map("'$_'", @{$manifest->{'ALL'}->{'TESTSUITES'}})).");\n" .
437
generate_ts_files() . "\n" .
438
generate_ts_times() . "\n" .
439
generate_file_sizes() . "\n" .
440
generate_ts_options() . "\n" .
441
generate_ts_expect_info() . "\n" .
442
generate_mod_cat_list_check_list();
445
# PUBLIC: Generates JS code for setting all options according to profile data.
446
# $page specifies the caller page ('cert' for 'Get Certified' or 'conf' for 'Custom Tests').
447
sub generate_profile_init($$) {
448
my ($profile, $page) = @_;
449
return '' if (!$profile);
451
'NAME' => 'tester_name',
452
'ORGANIZATION' => 'organization',
453
'EMAIL' => 'tester_email',
454
'SEND_EMAIL' => 'send_email_report',
455
'VERBOSE_LEVEL' => 'verbose_level',
456
'SHORT_SCENARIOS' => 'short_scen',
457
'ARCHITECTURE' => 'architecture',
458
'USE_INTERNET' => 'use_internet',
459
'STD_VERSION' => 'std_version',
460
'STD_PROFILE' => 'std_profile',
461
'COMMENTS' => 'comments'
464
my $current_std = $profile->{'GENERAL'}->{'STD_VERSION'};
465
my $current_std_id = $current_std;
466
$current_std_id =~ s/ /:/g;
467
my $current_arch = $profile->{'GENERAL'}->{'ARCHITECTURE'};
471
// Reset all values changed by user
474
elem = document.getElementById('architecture');
476
elem.value = '$current_arch';
478
elem = document.getElementById('std_version');
480
elem.value = '$current_std';
485
if ($page ne 'cert') {
487
ts_file_inst = new Array();
488
ts_file_dl = new Array();
489
for (var arch_std in ts_expect_info) {
490
for (var ts in ts_expect_info[arch_std]) {
491
for (var status in ts_expect_info[arch_std][ts]) {
492
for (var ver in ts_expect_info[arch_std][ts][status]) {
493
for (var id in ts_expect_info[arch_std][ts][status][ver]) {
494
var option = ts_expect_info[arch_std][ts][status][ver][id];
495
option.answer = option.def_answer;
505
$res .= "\tvar to_set_value = new Array();\n";
506
foreach my $name (qw/NAME ORGANIZATION EMAIL VERBOSE_LEVEL STD_PROFILE/) {
507
$res .= "\tto_set_value['".$js_names{$name}."'] = '".$profile->{'GENERAL'}->{$name}."';\n" if (defined($profile->{'GENERAL'}->{$name}));
509
if (defined($profile->{'GENERAL'}->{'COMMENTS'})) {
510
my $comments = $profile->{'GENERAL'}->{'COMMENTS'};
511
$comments =~ s/\r?\n/\\n/g;
512
$res .= "\tto_set_value['".$js_names{'COMMENTS'}."'] = '".$comments."';\n";
515
$res .= "\tvar to_set_check = new Array();\n";
516
foreach my $name (qw/SEND_EMAIL SHORT_SCENARIOS USE_INTERNET/) {
517
$res .= "\tto_set_check['".$js_names{$name}."'] = ".($profile->{'GENERAL'}->{$name} ? "1" : "0").";\n" if (defined($profile->{'GENERAL'}->{$name}));
522
for (var elem_id in to_set_check) {
523
elem = document.getElementById(elem_id);
525
elem.checked = to_set_check[elem_id];
528
for (var elem_id in to_set_value) {
529
elem = document.getElementById(elem_id);
531
elem.value = to_set_value[elem_id];
537
if ($page ne 'cert') {
538
my $set_versions = '';
539
my $expect_info = '';
541
if (defined($profile->{'TEST_SUITES'})) {
542
foreach my $ts (keys %{$profile->{'TEST_SUITES'}}) {
543
my $ts_info = $profile->{'TEST_SUITES'}->{$ts};
544
if ($ts_info->{'RUN'}) {
545
$check_ts .= "\tto_check_ts['$ts'] = 1;\n";
547
if ($ts_info->{'OPTIONS'}) {
548
my $check_ts_tmp = '';
549
foreach (keys %{$ts_info->{'OPTIONS'}}) {
550
$check_ts_tmp .= "\tto_check_ts_opt['$ts']['$_'] = '".$ts_info->{'OPTIONS'}->{$_}."';\n";
552
if ($check_ts_tmp ne '') {
553
$check_ts .= "\tto_check_ts_opt['$ts'] = new Array();\n".$check_ts_tmp;
556
if ($ts_info->{'AUTO_REPLIES'}) {
557
$expect_info .= "\tif (check_array_elem(ts_expect_info, '$current_arch-$current_std_id', '$ts')) {\n";
558
foreach my $status (keys %{$ts_info->{'AUTO_REPLIES'}}) {
559
$expect_info .= "\t\tif (ts_expect_info['$current_arch-$current_std_id']['$ts']['$status']) {\n";
560
foreach my $ver (keys %{$ts_info->{'AUTO_REPLIES'}->{$status}}) {
561
$expect_info .= "\t\t\telem = ts_expect_info['$current_arch-$current_std_id']['$ts']['$status']['$ver'];\n\t\t\tif (elem) {\n";
562
my $auto_replies = $ts_info->{'AUTO_REPLIES'}->{$status}->{$ver};
563
foreach my $id (keys %$auto_replies) {
564
$expect_info .= "\t\t\t\tif (elem['$id']) {\n\t\t\t\t\telem['$id'].answer = '".(defined($auto_replies->{$id}) ? $auto_replies->{$id} : '[default]')."';\n\t\t\t\t}\n";
566
$expect_info .= "\t\t\t}\n";
568
$expect_info .= "\t\t}\n";
570
$expect_info .= "\t}\n";
572
if ($ts_info->{'STATUS'} and $ts_info->{'VERSION'}) {
573
$set_versions .= "\tacceptVersion('$ts', '".$ts_info->{'STATUS'}."', '".$ts_info->{'VERSION'}."', false);\n";
578
$set_versions .= "\n" if ($set_versions ne '');
579
$expect_info .= "\n" if ($expect_info ne '');
581
if ($check_ts ne '') {
583
var to_check_ts = new Array();
584
var to_check_ts_opt = new Array();
586
var cat_list = new Array();
587
// Make a copy of the array mod_cat_list (for current arch-std only).
588
for (var cat in mod_cat_list[current_arch_std]) {
589
cat_list[cat] = mod_cat_list[current_arch_std][cat].slice(0);
591
for (var mod in to_check_ts) {
592
// Remove the test suite from the array cat.
593
for (var cat in cat_list) {
594
for (var i=0; i<cat_list[cat].length; ++i) {
595
if (cat_list[cat][i] == mod) {
596
cat_list[cat].splice(i, 1);
601
elem = document.getElementById('mod-' + current_arch_std + '-' + mod);
605
if (to_check_ts_opt[mod]) {
606
for (var opt_name in to_check_ts_opt[mod]) {
607
var opt_value = to_check_ts_opt[mod][opt_name];
608
var elems = document.getElementsByName('modopt-' + current_arch_std + '-' + mod + '-' + opt_name);
610
for (var i=0; i<elems.length; ++i) {
611
elems[i].checked = (elems[i].value == opt_value);
617
for (var cat in cat_list) {
618
elem = document.getElementById('check-' + cat + '-' + current_arch_std);
620
elem.checked = ((cat_list[cat].length > 0) ? false : true);
627
if (defined($profile->{'FILES'})) {
628
foreach my $file (keys %{$profile->{'FILES'}}) {
629
if ($profile->{'FILES'}->{$file}->{'DOWNLOAD'}) {
630
$res .= "\tts_file_dl['$file'] = ".$profile->{'FILES'}->{$file}->{'DOWNLOAD'}.";\n";
632
if ($profile->{'FILES'}->{$file}->{'INSTALL'}) {
633
$res .= "\tts_file_inst['$file'] = ".$profile->{'FILES'}->{$file}->{'INSTALL'}.";\n";
639
$res .= $expect_info;
640
$res .= $set_versions;
641
$res .= "\tupdate_elements_state();\n";
644
$res .= "\tcontrol_profile_list();\n";
646
$res .= "\telem = document.getElementById('std_profile');\n\tif (elem) {\n\t\telem.value = to_set_value['std_profile'];\n\t}\n";
651
################################################################################
652
# Initialization code
656
$manifest = load_manifest();
657
if (!is_ok($manifest)) {
658
push @buildlist_errors, error("Failed to load manifest", $Error::Last)->tostring;
661
@all_std_versions = @{$manifest->{'ALL'}->{'STANDARDS'}};
663
# Detect the architecture
664
my $arch = detect_architecture();
666
push @buildlist_errors, "Can't determine the machine architecture";
669
@supported_archs = backward_compatible_platforms($arch);
671
# See what packages are installed
672
$Packages::package_manager = guess_package_manager(detect_OS());
674
is_ok packages_info($manifest->{'PACKAGES'})
675
or push @buildlist_errors, $Error::Last->tostring;
677
check_files(values %{$manifest->{'FILES'}});
679
# Build the tests tree