~ubuntu-branches/ubuntu/precise/nss/precise-security

« back to all changes in this revision

Viewing changes to mozilla/security/nss/lib/freebl/mpi/make-test-arrays

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2013-11-14 14:58:07 UTC
  • mfrom: (1.1.19)
  • Revision ID: package-import@ubuntu.com-20131114145807-ay302kimn72ovt88
Tags: 3.15.3-0ubuntu0.12.04.1
* SECURITY UPDATE: New upstream release to fix multiple security issues
  and add TLSv1.2 support.
  - CVE-2013-1739
  - CVE-2013-1741
  - CVE-2013-5605
  - CVE-2013-5606
* Adjusted packaging for 3.15.3:
  - debian/patches/*: refreshed.
  - debian/patches/lower-dhe-priority.patch: removed, no longer needed,
    was a workaround for an old version of firefox.
  - debian/libnss3.symbols: added new symbols.
  - debian/rules: updated for new source layout.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
 
3
 
#
4
 
# make-test-arrays
5
 
#
6
 
# Given a test-arrays file, which specifies the test suite names, the
7
 
# names of the functions which perform those test suites, and
8
 
# descriptive comments, this script generates C structures for the
9
 
# mpi-test program.  The input consists of lines of the form:
10
 
#
11
 
# suite-name:function-name:comment
12
 
#
13
 
# The output is written to the standard output.  Blank lines are
14
 
# ignored, and comments beginning with '#' are stripped.
15
 
 
16
 
# This Source Code Form is subject to the terms of the Mozilla Public
17
 
# License, v. 2.0. If a copy of the MPL was not distributed with this
18
 
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
19
 
 
20
 
# $Id: make-test-arrays,v 1.4 2012/04/25 14:49:50 gerv%gerv.net Exp $
21
 
#
22
 
 
23
 
# Read parameters from the environment, if available
24
 
$NAMEVAR = $ENV{'NAMEVAR'} || "g_names";
25
 
$COUNTVAR = $ENV{'COUNTVAR'} || "g_count";
26
 
$FUNCVAR = $ENV{'FUNCVAR'} || "g_tests";
27
 
$DESCVAR = $ENV{'DESCVAR'} || "g_descs";
28
 
$FUNCLEN = 13;
29
 
$NAMELEN = 18;
30
 
$DESCLEN = 45;
31
 
 
32
 
#------------------------------------------------------------------------
33
 
# Suck in input from the files on the command line, or standard input
34
 
while(<>) {
35
 
    chomp;
36
 
    s/\#.*$//;
37
 
    next if /^\s*$/;
38
 
 
39
 
    ($suite, $func, $desc) = split(/:/, $_);
40
 
 
41
 
    $tmp = { "suite" => $suite,
42
 
             "func"  => $func,
43
 
             "desc"  => $desc };
44
 
 
45
 
    push(@item, $tmp);
46
 
}
47
 
$count = scalar(@item);
48
 
$last = pop(@item);
49
 
 
50
 
#------------------------------------------------------------------------
51
 
# Output the table of names
52
 
print "/* Table mapping test suite names to index numbers */\n";
53
 
printf("const int   %s = %d;\n", $COUNTVAR, $count);
54
 
printf("const char *%s[] = {\n", $NAMEVAR);
55
 
 
56
 
foreach $elt (@item) {
57
 
    printf("   \"%s\",%s/* %s%s */\n", $elt->{"suite"},
58
 
           " " x ($NAMELEN - length($elt->{"suite"})),
59
 
           $elt->{"desc"},
60
 
           " " x ($DESCLEN - length($elt->{"desc"})));
61
 
}
62
 
printf("   \"%s\" %s/* %s%s */\n", $last->{"suite"},
63
 
       " " x ($NAMELEN - length($last->{"suite"})),
64
 
       $last->{"desc"},
65
 
       " " x ($DESCLEN - length($last->{"desc"})));
66
 
print "};\n\n";
67
 
 
68
 
#------------------------------------------------------------------------
69
 
# Output the driver function prototypes
70
 
print "/* Test function prototypes */\n";
71
 
foreach $elt (@item, $last) {
72
 
    printf("int  %s(void);\n", $elt->{"func"});
73
 
}
74
 
print "\n";
75
 
 
76
 
#------------------------------------------------------------------------
77
 
# Output the table of functions
78
 
print "/* Table mapping index numbers to functions */\n";
79
 
printf("int (*%s[])(void)  = {\n   ", $FUNCVAR);
80
 
$brk = 0;
81
 
 
82
 
foreach $elt (@item) {
83
 
    print($elt->{"func"}, ", ", 
84
 
          " " x ($FUNCLEN - length($elt->{"func"})));
85
 
    $brk = ($brk + 1) & 3;
86
 
    print "\n   " unless($brk);
87
 
}
88
 
print $last->{"func"}, "\n};\n\n";
89
 
 
90
 
#------------------------------------------------------------------------
91
 
# Output the table of descriptions
92
 
print "/* Table mapping index numbers to descriptions */\n";
93
 
printf("const char *%s[] = {\n", $DESCVAR);
94
 
 
95
 
foreach $elt (@item) {
96
 
    printf("   \"%s\",\n", $elt->{"desc"});
97
 
}
98
 
printf("   \"%s\"\n};\n\n", $last->{"desc"});
99
 
 
100
 
exit 0;
101