Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: new argument to match script #1658

Merged
merged 1 commit into from
Feb 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/test/match
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
#
# Copyright 2014-2016, Intel Corporation
# Copyright 2014-2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -34,7 +34,7 @@
#
# match -- compare an output file with expected results
#
# usage: match [-adqv] [match-file]...
# usage: match [-adoqv] [match-file]...
#
# this script compares the output from a test run, stored in a file, with
# the expected output. comparison is done line-by-line until either all
Expand All @@ -61,6 +61,8 @@
# -a find all files of the form "X.match" in the current
# directory and match them again the corresponding file "X".
#
# -o custom output filename - only one match file can be given
#
# -d debug -- show lots of debug output
#
# -q don't print any output on mismatch (just exit with result code)
Expand All @@ -75,7 +77,7 @@ select STDERR;
my $Me = $0;
$Me =~ s,.*/,,;

our ($opt_a, $opt_d, $opt_q, $opt_v);
our ($opt_a, $opt_d, $opt_q, $opt_v, $opt_o);

$SIG{HUP} = $SIG{INT} = $SIG{TERM} = $SIG{__DIE__} = sub {
die @_ if $^S;
Expand All @@ -88,10 +90,11 @@ sub usage {

warn "$Me: $msg\n" if $msg;
warn "Usage: $Me [-adqv] [match-file]...\n";
warn " or: $Me [-dqv] -o output-file match-file...\n";
exit 1;
}

getopts('adqv') or usage;
getopts('adoqv') or usage;

my %match2file;

Expand All @@ -112,6 +115,10 @@ if ($opt_a) {
close(F);
$match2file{$mfile} = $ofile;
}
} elsif ($opt_o) {
usage("-o argument requires two paths") if $#ARGV != 1;

$match2file{$ARGV[1]} = $ARGV[0];
} else {
usage("no match-file arguments found") if $#ARGV == -1;

Expand Down