Whitespace and comment changes. No functionality change.
[llvm/msp430.git] / utils / importNLT.pl
blobc1b950dc34d804c98bb376c5f50d810b309841ce
1 #!/usr/bin/perl
2 #take the output of parseNLT.pl and load it into a database
3 # use like: cat file |perl parseNLT.pl |perl importNLT.pl password
5 use DBI;
7 # database information
8 $db="llvmalpha";
9 $host="localhost";
10 $userid="llvmdbuser";
11 $passwd=shift @ARGV;
12 $connectionInfo="dbi:mysql:$db;$host";
14 # make connection to database
15 $dbh = DBI->connect($connectionInfo,$userid,$passwd) or die DBI->errstr;
16 my $sth = $dbh->prepare( q{
17 INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES (?, STR_TO_DATE(?, '\%d \%M \%Y'), ?, ?)
18 }) || die "Can't prepare statement: $DBI::errstr";;
20 while($d = <>)
22 chomp $d;
23 if (18 == scalar split " ", $d)
25 ($day, $mon, $year, $prog, $gccas, $bc, $llccompile, $llcbetacompile, $jitcompile,
26 $mc, $gcc, $cbe, $llc, $llcbeta, $jit, $foo1, $foo2, $foo3) = split " ", $d;
27 if ($gccas =~ /\d+/)
29 $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES
30 ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'gccas', $gccas)") || die DBI->errstr;
32 if ($bc =~ /\d/)
34 $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES
35 ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'bytecode', $bc)") || die DBI->errstr;
37 if ($llccompile =~ /\d/)
39 $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES
40 ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'llc-compile', $llccompile)") || die DBI->errstr;
42 if ($llcbetacompile =~ /\d/)
44 $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES
45 ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'llc-beta-compile', $llcbetacompile)") || die DBI->errstr;
47 if ($jitcompile =~ /\d/)
49 $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES
50 ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'jit-compile', $jitcompile)") || die DBI->errstr;
52 if ($mc =~ /\d/)
54 $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES
55 ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'machine-code', $mc)") || die DBI->errstr;
57 if ($gcc =~ /\d/)
59 $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES
60 ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'gcc', $gcc)") || die DBI->errstr;
62 if ($llc =~ /\d/)
64 $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES
65 ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'llc', $llc)") || die DBI->errstr;
67 if ($llcbeta =~ /\d/)
69 $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES
70 ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'llc-beta', $llcbeta)") || die DBI->errstr;
72 if ($jit =~ /\d/)
74 $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES
75 ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'jit', $jit)") || die DBI->errstr;
77 print ".";
79 else
81 print "\nNO: $d\n";
84 print "\n";
85 # disconnect from database
86 $dbh->disconnect;