diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2005-04-27 16:03:01 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2005-04-27 16:03:01 +0000 |
commit | 91aa9eec5ff31073b34b63056c4c13e15f370162 (patch) | |
tree | fba494e1914c688865e3856a9368241885ff5e0f /utils/importNLT.pl | |
parent | 6e92729e988e5528ee8cd0c034561054d75dc8ff (diff) |
So you want to import nightly tester data into a data base? Have we got the perl script for you
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21592 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/importNLT.pl')
-rw-r--r-- | utils/importNLT.pl | 74 |
1 files changed, 67 insertions, 7 deletions
diff --git a/utils/importNLT.pl b/utils/importNLT.pl index a46123b3da..1511803e81 100644 --- a/utils/importNLT.pl +++ b/utils/importNLT.pl @@ -1,26 +1,86 @@ #!/usr/bin/perl #take the output of parseNLT.pl and load it into a database +# use like: cat file |perl parseNLT.pl |perl importNLT.pl password use DBI; # database information $db="llvmalpha"; -$host="narya.lenharth.org"; +$host="localhost"; $userid="llvmdbuser"; -$passwd=""; #removed for obvious reasons +$passwd=shift @ARGV; $connectionInfo="dbi:mysql:$db;$host"; # make connection to database $dbh = DBI->connect($connectionInfo,$userid,$passwd) or die DBI->errstr; +my $sth = $dbh->prepare( q{ + INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES (?, STR_TO_DATE(?, '\%d \%M \%Y'), ?, ?) + }) || die "Can't prepare statement: $DBI::errstr";; while($d = <>) { - if (18 == split / /, $d) + chomp $d; + if (18 == scalar split " ", $d) { - ($day, $mon, $year, $prog, $gccas, $bc, $llc-compile, $llc-beta-compile, $jit-compile, - $mc, $gcc, $cbe, $llc, $llc-beta, $jit, $foo1, $foo2, $foo3) = split / /, $d; - print "."; + ($day, $mon, $year, $prog, $gccas, $bc, $llccompile, $llcbetacompile, $jitcompile, + $mc, $gcc, $cbe, $llc, $llcbeta, $jit, $foo1, $foo2, $foo3) = split / /, $d; + if ($gccas =~ /\d+/) + { + $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES + ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'gccas', $gccas)") || die DBI->errstr; + } + if ($bc =~ /\d/) + { + $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES + ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'bytecode', $bc)") || die DBI->errstr; + } + if ($llccompile =~ /\d/) + { + $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES + ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'llc-compile', $llccompile)") || die DBI->errstr; + } + if ($llcbetacompile =~ /\d/) + { + $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES + ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'llc-beta-compile', $llcbetacompile)") || die DBI->errstr; + } + if ($jitcompile =~ /\d/) + { + $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES + ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'jit-compile', $jitcompile)") || die DBI->errstr; + } + if ($mc =~ /\d/) + { + $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES + ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'machine-code', $mc)") || die DBI->errstr; + } + if ($gcc =~ /\d/) + { + $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES + ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'gcc', $gcc)") || die DBI->errstr; + } + if ($llc =~ /\d/) + { + $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES + ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'llc', $llc)") || die DBI->errstr; + } + if ($llcbeta =~ /\d/) + { + $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES + ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'llc-beta', $llcbeta)") || die DBI->errstr; + } + if ($jit =~ /\d/) + { + $dbh->do("INSERT INTO Tests (NAME, RUN, TEST, VALUE) VALUES + ('$prog', STR_TO_DATE('$day $mon $year', '\%d \%M \%Y'), 'jit', $jit)") || die DBI->errstr; + } + print "."; + } + else + { + print "\nNO: $d\n"; } } +print "\n"; # disconnect from database -$dbh->disconnect +$dbh->disconnect; |