3
# Copyright (C) 2009 Sun Microsystems, Inc. All rights reserved. Use
4
# is subject to license terms.
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; version 2 of the License.
10
# This program is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
# General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
21
use lib "$ENV{RQG_HOME}/lib";
25
use GenTest::Constants;
32
my ($grammar_file, $mask, $mask_level, $thread_id, $help);
34
my @ARGV_saved = @ARGV;
36
my $opt_result = GetOptions(
37
'grammar=s' => \$grammar_file,
39
'mask-level=i' => \$mask_level,
40
'thread-id=i' => \$thread_id
43
help() if !$opt_result || $help || not defined $grammar_file;
45
my $grammar = GenTest::Grammar->new( grammar_file => $grammar_file );
47
my $top_grammar = ($mask_level > 0) ? $grammar->topGrammar($mask_level, "thread".$thread_id, "query") : $grammar;
50
my $masked_grammar = $top_grammar->mask($mask);
51
$grammar = $grammar->patch($masked_grammar);
54
print $grammar->toString();
60
$0 - Dump a grammar after applying masking
62
--grammar : Grammar file to use for generating the queries (REQUIRED);
63
--mask : A seed to a random mask used to mask (reeduce) the grammar.
64
--mask-level: How many levels deep the mask is applied (default 1)
65
--help : This help message