1#! /usr/local/bin/perl
2
3if (not -e "Log") {
4  `mkdir Log`;
5}
6
7if ($#ARGV != 0) {
8  print <<TEXT;
9
10USAGE:
11
12  $0 <application>
13
14  The only supported application at this time is wblast2.REAL.
15TEXT
16  exit();
17}
18
19my $app = $ARGV[0];
20my $diff = 'diff -w';
21my $time = &GetTimeCmd();
22
23my $oldbin = "/net/blast152/export/home/web/public/htdocs/BLAST/bl2seq/$app";
24#my $oldbin = "../wblast2.REAL.old";
25
26chomp(my $basedir = `pwd`);
27my $newbin = "$basedir/$app";
28
29my $out = "out";
30
31if (not -e "$out") {
32  `mkdir $out`;
33}
34
35my %Tests;
36
37if ($app eq "wblast2.REAL" or $app eq "wblast2_cs.REAL") {
38   $Tests{'blastp'} = "\"ONE=129295&TWO=XP_222492.2&FILTER=1&PROGRAM=blastp\"";
39
40   $Tests{'blastn'} = "\"ONE=555&TWO=101&FILTER=1&PROGRAM=blastn\"";
41
42   $Tests{'megablast'} = "\"ONE=555&TWO=AC091728&FILTER=1&PROGRAM=blastn&MEGABLAST=yes&WORD=20\"";
43
44   $Tests{'tblastn'} = "\"ONE=9930103&TWO=9930102&FILTER=1&PROGRAM=tblastn\"";
45
46   $Tests{'blastx'} = "\"ONE=3090&TWO=3091&FILTER=1&PROGRAM=blastx\"";
47
48   $Tests{'tblastx'} = "\"ONE=555&TWO=101&PROGRAM=tblastx&FILTER=1&WORD=3\"";
49
50   $Tests{'blastn-minus'} = "\"ONE=NT_004487.15&TWO=AA441981.1&FROM=7685545&TO=7686027&FFROM=10&TTO=480&STRAND=2&FILTER=1&PROGRAM=blastn\"";
51
52   $Tests{'blastn-plus'} = "\"ONE=NT_004487.15&TWO=AA441981.1&FROM=7685545&TO=7686027&FFROM=10&TTO=480&STRAND=1&FILTER=1&PROGRAM=blastn\"";
53
54   $Tests{'fully-masked'} = "\"ONE=U09816&TWO=BX641126.1&FROM=1280&TO=1324&FFROM=2052&TTO=2082&STRAND=2&PROGRAM=blastn\"";
55   $Tests{'blastx-long-filter'} = "\"ONE=2655203&TWO=2655204&PROGRAM=blastx&FILTER=T\"";
56   $Tests{'filtered-query'} = "\"PROGRAM=blastn&FILTER=1&TWO=555&SEQ=CATCATCATCATCATCAGGCATCATCATGCATCATCATCATCAGCATCAT\"";
57# short-subject-discmb finds no hits because there are no words to search;
58# short-subject-blastn finds one hit.
59   $Tests{'short-subject-discmb'} = "\"PROGRAM=blastn&ONE=AE003820&SSEQ=aggacctcatcagcctcaaa&WORD=11&EXPECT=10000&MEGABLAST=yes\"";
60   $Tests{'short-subject-blastn'} = "\"PROGRAM=blastn&ONE=AE003820&SSEQ=aggacctcatcagcctcaaa&WORD=11&EXPECT=10000\"";
61   $Tests{'bare-fasta'} = "\"PROGRAM=blastn&SEQ=agcctggtaggctgcagtccatggggtcacacagagtcggacatgactgagcgacttcac&SSEQ=agcctggtaggctgcaatccatggggtcgctagagtcggacacgactgagcgacttcac&PROGRAM=blastn&FILTER=1\"";
62   $Tests{'cds_feature_plus'} = "\"ONE=48869482&TWO=60844&FROM=&TO=&FFROM=&TTO=&STRAND=1&FILTER=1&PROGRAM=blastn&cds_translation=on\"";
63   $Tests{'maks_color'} = "\"page=2&match=1&msmatch=-2&gopen=5&gext=2&dropoff=50&expect=10.000000&word=11&Filter=1&view=1&mask_char=2&mask_color=3&cds_translation=on&program=blastn&matrix=0&seq=u93236+&sseq=u93237&from=1&to=2772&ffrom=1&tto=9180\"";
64} else {
65  if ($app eq "blast_cs.REAL") {
66
67
68  }
69}
70
71foreach $test (keys %Tests) {
72    print "\nTest ", $test, "";
73    print "\n----------------\n";
74    print "Parameters: $Tests{$test}\n\n";
75
76    foreach $binary_type (qw(New Old)) {
77
78        print "\t\"$binary_type\".  Time: ";
79
80        if ($binary_type eq "New") {
81            $binary = $newbin;
82        } else {
83            $binary = $oldbin;
84        }
85        $rv = system("$time sh -c '$binary $Tests{$test}' > $out/$test.$binary_type.out 2> $out/$test.$binary_type.err");
86        $time_str = `tail -3 $out/$test.$binary_type.err | tr -s "\n" " "`;
87        chomp($time_str);
88        print $time_str, "\n";
89    }
90    `$diff $out/$test.Old.out $out/$test.New.out > $out/$test.diff`;
91}
92
93sub GetTimeCmd() {
94    return "/usr/bin/time -p" if (`uname` =~ /linux/i);
95    return "/usr/bin/time";
96}
97
98