[Patch] When the order of the parameters is different, the behavior of jtdiff is different.

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu Aug 30 18:07:08 UTC 2018


Hi,

Thank you for your interest, and the report, but jtdiff is behaving as 
expected,
and no update is necessary (apart from fixing the help info, which I 
will take
care of).

In the case when the error is reported, your command line is invalid, 
because
you are mixing options and files, when the command line help indicates that
options should occur before any positional file arguments.

So, to be clear:

     -s is an option that no arguments
     -o is an option that takes a directory as an argument
     results/ looks like the directory you are wanting to compare, and 
should be
         the first (and in this case, only) positional argument

Look at your commands:

    $ jtdiff -s results/ -o tmp/
    Error: Bad directory argument for "super" mode

The positional file args will be all 3 of "results/", "-o", "/tmp" and 
you'll get an error
message because -o does not exist as a file or directory.

    $ jtdiff -o tmp/ -s results/
    Differences found.

Yes, "-s" is specified correcttly as a single no-arg option, and "results/"
is the first positional file arg

If you wanted to swap -s and -o options, this would be the way to do it:

    $ jtdiff -s -o tmp/ results/

-- Jon

On 08/30/2018 05:36 AM, Ao Qi wrote:
> Hi all,
>
> I do not know if some one uses jtdiff. When I use this tool, I think I
> found a bug. When the order of the parameters is different, the
> behavior is different.
>
> $ jtdiff -s results/ -o tmp/
> Error: Bad directory argument for "super" mode
>
> $ jtdiff -o tmp/ -s results/
> Differences found.
>
> I found it is because when there are more then one args which start
> with "-", jtdiff do not set inFiles = false. I made a small patch to
> fix this. I did not test this patch very much.
>
> diff -r fdfb9ee98733
> src/share/classes/com/sun/javatest/regtest/tool/OptionDecoder.java
> --- a/src/share/classes/com/sun/javatest/regtest/tool/OptionDecoder.java
> Fri Aug 03 16:03:18 2018 -0700
> +++ b/src/share/classes/com/sun/javatest/regtest/tool/OptionDecoder.java
> Thu Aug 30 20:26:49 2018 +0800
> @@ -81,6 +81,8 @@
>                   throw new BadArgs(i18n, "opt.empty");
>               if (!arg.startsWith("-"))
>                   inFiles = true;
> +            else
> +                inFiles = false;
>               if (inFiles) {
>                   fileOption.process(null, arg);
>               } else
>
> In addition,
>
> $ jtdiff -h
> Compare Options
>
>      --r | --reason  Include the reason string in the comparison, as well as the
>                      type (i.e. Passed, Failed, etc.)
>      --s | --super   Perform a "super-diff" looking for result sets within a
>                      directory hierarchy. The hierarchy must be arranged as
>                      follows: PATH/PLATFORM/YEAR/DAY_OF_YEAR/TEST_RESULTS, where
> ...
>
> However, it should be "-s", not "--s".
>
> Thanks,
> Ao Qi



More information about the jtreg-dev mailing list