langtools/test/tools/javac/modules/EnvVarTest.java
changeset 43874 d49715456f51
parent 40308 274367a99f98
equal deleted inserted replaced
43873:705d732d3715 43874:d49715456f51
     1 /*
     1 /*
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 8156962
    26  * @bug 8156962
    27  * @summary Tests use of _JAVAC_OPTIONS env variable
    27  * @summary Tests use of JDK_JAVAC_OPTIONS env variable
    28  * @library /tools/lib
    28  * @library /tools/lib
    29  * @modules jdk.compiler/com.sun.tools.javac.api
    29  * @modules jdk.compiler/com.sun.tools.javac.api
    30  *          jdk.compiler/com.sun.tools.javac.main
    30  *          jdk.compiler/com.sun.tools.javac.main
    31  * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
    31  * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
    32  * @run main EnvVarTest
    32  * @run main EnvVarTest
    69                 .run(Expect.SUCCESS)
    69                 .run(Expect.SUCCESS)
    70                 .writeAll();
    70                 .writeAll();
    71 
    71 
    72         tb.out.println("test that addExports can be provided with env variable");
    72         tb.out.println("test that addExports can be provided with env variable");
    73         new JavacTask(tb, Mode.EXEC)
    73         new JavacTask(tb, Mode.EXEC)
    74                 .envVar("_JAVAC_OPTIONS", "--add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED")
    74                 .envVar("JDK_JAVAC_OPTIONS", "--add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED")
    75                 .outdir(classes)
    75                 .outdir(classes)
    76                 .files(findJavaFiles(src))
    76                 .files(findJavaFiles(src))
    77                 .run(Expect.SUCCESS)
    77                 .run(Expect.SUCCESS)
    78                 .writeAll();
    78                 .writeAll();
    79 
    79 
    81         Path atFile = src.resolve("at-file.txt");
    81         Path atFile = src.resolve("at-file.txt");
    82         tb.writeFile(atFile,
    82         tb.writeFile(atFile,
    83                 "--add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED");
    83                 "--add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED");
    84 
    84 
    85         new JavacTask(tb, Mode.EXEC)
    85         new JavacTask(tb, Mode.EXEC)
    86                 .envVar("_JAVAC_OPTIONS", "@" + atFile)
    86                 .envVar("JDK_JAVAC_OPTIONS", "@" + atFile)
    87                 .outdir(classes)
    87                 .outdir(classes)
    88                 .files(findJavaFiles(src))
    88                 .files(findJavaFiles(src))
    89                 .run(Expect.SUCCESS)
    89                 .run(Expect.SUCCESS)
    90                 .writeAll();
    90                 .writeAll();
    91     }
    91     }