test/jdk/tools/jlink/JLinkNegativeTest.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 45004 jdk/test/tools/jlink/JLinkNegativeTest.java@ea3137042a61
child 47399 fb677b3f0888
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/**
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     4
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     8
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    13
 * accompanied this code).
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    14
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    18
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    21
 * questions.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    22
 */
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    23
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    24
/*
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    25
 * @test
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    26
 * @summary Negative tests for jlink
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    27
 * @bug 8130861
43796
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
    28
 * @bug 8174718
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    29
 * @author Andrei Eremeev
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    30
 * @library ../lib
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    31
 * @modules java.base/jdk.internal.jimage
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    32
 *          java.base/jdk.internal.module
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    33
 *          jdk.jdeps/com.sun.tools.classfile
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    34
 *          jdk.jlink/jdk.tools.jlink.internal
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    35
 *          jdk.jlink/jdk.tools.jmod
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    36
 *          jdk.jlink/jdk.tools.jimage
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    37
 *          jdk.compiler
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    38
 * @build tests.*
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    39
 * @run testng JLinkNegativeTest
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    40
 */
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    41
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    42
import java.io.IOException;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    43
import java.io.OutputStream;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    44
import java.lang.module.ModuleDescriptor;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    45
import java.nio.file.FileVisitResult;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    46
import java.nio.file.Files;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    47
import java.nio.file.Path;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    48
import java.nio.file.Paths;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    49
import java.nio.file.SimpleFileVisitor;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    50
import java.nio.file.attribute.BasicFileAttributes;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    51
import java.util.Arrays;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    52
import java.util.Collections;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    53
import java.util.List;
43796
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
    54
import java.util.Set;
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    55
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    56
import jdk.internal.module.ModuleInfoWriter;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    57
import org.testng.SkipException;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    58
import org.testng.annotations.BeforeClass;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    59
import org.testng.annotations.Test;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    60
import tests.Helper;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    61
import tests.JImageGenerator;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    62
import tests.JImageGenerator.InMemoryFile;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    63
import tests.Result;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    64
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    65
@Test
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    66
public class JLinkNegativeTest {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    67
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    68
    private Helper helper;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    69
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    70
    @BeforeClass
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    71
    public void setUp() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    72
        helper = Helper.newHelper();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    73
        if (helper == null) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    74
            throw new SkipException("Not run");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    75
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    76
        helper.generateDefaultModules();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    77
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    78
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    79
    private void deleteDirectory(Path dir) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    80
        Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    81
            @Override
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    82
            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    83
                Files.delete(file);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    84
                return FileVisitResult.CONTINUE;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    85
            }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    86
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    87
            @Override
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    88
            public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    89
                Files.delete(dir);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    90
                return FileVisitResult.CONTINUE;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    91
            }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    92
        });
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    93
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    94
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    95
    public void testModuleNotExist() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    96
        helper.generateDefaultImage("failure1").assertFailure("Error: Module failure1 not found");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    97
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    98
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    99
    public void testNotExistInAddMods() {
40261
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 36511
diff changeset
   100
        // cannot find jmod from --add-modules
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   101
        JImageGenerator.getJLinkTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   102
                .modulePath(".")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   103
                .addMods("not_exist")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   104
                .output(helper.getImageDir().resolve("failure2"))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   105
                .call().assertFailure("Error: Module not_exist not found");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   106
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   107
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   108
    public void test() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   109
        helper.generateDefaultJModule("failure3");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   110
        Path image = helper.generateDefaultImage("failure3").assertSuccess();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   111
        JImageGenerator.getJLinkTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   112
                .modulePath(helper.defaultModulePath())
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   113
                .output(image)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   114
                .addMods("leaf1")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   115
                .limitMods("leaf1")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   116
                .call().assertFailure("Error: directory already exists: .*failure3.image(\n|\r|.)*");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   117
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   118
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   119
    public void testOutputIsFile() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   120
        // output == file
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   121
        Path image = helper.createNewImageDir("failure4");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   122
        Files.createFile(image);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   123
        JImageGenerator.getJLinkTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   124
                .modulePath(helper.defaultModulePath())
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   125
                .output(image)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   126
                .addMods("leaf1")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   127
                .call().assertFailure("Error: directory already exists: .*failure4.image(\n|\r|.)*");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   128
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   129
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   130
    public void testModuleNotFound() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   131
        // limit module is not found
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   132
        Path imageFile = helper.createNewImageDir("test");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   133
        JImageGenerator.getJLinkTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   134
                .output(imageFile)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   135
                .addMods("leaf1")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   136
                .limitMods("leaf1")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   137
                .limitMods("failure5")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   138
                .modulePath(helper.defaultModulePath())
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   139
                .call().assertFailure("Error: Module failure5 not found");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   140
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   141
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   142
    public void testJmodIsDir() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   143
        Path imageFile = helper.createNewImageDir("test");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   144
        Path dirJmod = helper.createNewJmodFile("dir");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   145
        Files.createDirectory(dirJmod);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   146
        try {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   147
            JImageGenerator.getJLinkTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   148
                    .output(imageFile)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   149
                    .addMods("dir")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   150
                    .modulePath(helper.defaultModulePath())
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   151
                    .call().assertFailure("Error: Module dir not found");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   152
        } finally {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   153
            deleteDirectory(dirJmod);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   154
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   155
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   156
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   157
    public void testJarIsDir() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   158
        Path imageFile = helper.createNewImageDir("test");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   159
        Path dirJar = helper.createNewJarFile("dir");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   160
        Files.createDirectory(dirJar);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   161
        try {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   162
            JImageGenerator.getJLinkTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   163
                    .output(imageFile)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   164
                    .addMods("dir")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   165
                    .modulePath(helper.defaultModulePath())
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   166
                    .call().assertFailure("Error: Module dir not found");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   167
        } finally {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   168
            deleteDirectory(dirJar);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   169
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   170
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   171
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   172
    public void testMalformedJar() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   173
        Path imageFile = helper.createNewImageDir("test");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   174
        Path jar = helper.createNewJarFile("not_zip");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   175
        Files.createFile(jar);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   176
        try {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   177
            JImageGenerator.getJLinkTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   178
                    .output(imageFile)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   179
                    .addMods("not_zip")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   180
                    .modulePath(helper.defaultModulePath())
45004
ea3137042a61 8178380: Module system implementation refresh (5/2017)
alanb
parents: 44359
diff changeset
   181
                    .call().assertFailure("Error: Error reading");
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   182
        } finally {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   183
            deleteDirectory(jar);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   184
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   185
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   186
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   187
    public void testMalformedJmod() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   188
        Path imageFile = helper.createNewImageDir("test");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   189
        Path jmod = helper.createNewJmodFile("not_zip");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   190
        Files.createFile(jmod);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   191
        try {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   192
            JImageGenerator.getJLinkTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   193
                    .output(imageFile)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   194
                    .addMods("not_zip")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   195
                    .modulePath(helper.defaultModulePath())
44359
c6761862ca0b 8174823: Module system implementation refresh (3/2017)
alanb
parents: 43796
diff changeset
   196
                    .call().assertFailure("Error: java.io.IOException: Invalid JMOD file");
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   197
        } finally {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   198
            deleteDirectory(jmod);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   199
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   200
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   201
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   202
    // Temporarily exclude; the jmod tool can no longer be used to create a jmod
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   203
    // with a class in the unnamed package. Find another way, or remove.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   204
//    public void testAddDefaultPackage() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   205
//        String moduleName = "hacked1";
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   206
//        Path module = helper.generateModuleCompiledClasses(helper.getJmodSrcDir(), helper.getJmodClassesDir(),
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   207
//                moduleName, Arrays.asList("hacked1.Main", "A", "B"), "leaf1");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   208
//        JImageGenerator
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   209
//                .getJModTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   210
//                .addClassPath(module)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   211
//                .jmod(helper.getJmodDir().resolve(moduleName + ".jmod"))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   212
//                .create().assertSuccess();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   213
//        Path image = helper.generateDefaultImage(moduleName).assertSuccess();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   214
//        helper.checkImage(image, moduleName, null, null);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   215
//    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   216
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   217
    public void testAddSomeTopLevelFiles() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   218
        String moduleName = "hacked2";
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   219
        Path module = helper.generateModuleCompiledClasses(helper.getJmodSrcDir(), helper.getJmodClassesDir(),
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   220
                moduleName);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   221
        Files.createFile(module.resolve("top-level-file"));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   222
        Path jmod = JImageGenerator
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   223
                .getJModTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   224
                .addClassPath(module)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   225
                .jmod(helper.getJmodDir().resolve(moduleName + ".jmod"))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   226
                .create().assertSuccess();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   227
        try {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   228
            Path image = helper.generateDefaultImage(moduleName).assertSuccess();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   229
            helper.checkImage(image, moduleName, null, null);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   230
        } finally {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   231
            deleteDirectory(jmod);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   232
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   233
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   234
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   235
    public void testAddNonStandardSection() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   236
        String moduleName = "hacked3";
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   237
        Path module = helper.generateDefaultJModule(moduleName).assertSuccess();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   238
        JImageGenerator.addFiles(module, new InMemoryFile("unknown/A.class", new byte[0]));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   239
        try {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   240
            Result result = helper.generateDefaultImage(moduleName);
41352
f9844bad9052 8166860: Add magic number to jmod file
mchung
parents: 40261
diff changeset
   241
            System.err.println(result.getMessage());
f9844bad9052 8166860: Add magic number to jmod file
mchung
parents: 40261
diff changeset
   242
            if (result.getExitCode() == 0) {
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   243
                throw new AssertionError("Crash expected");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   244
            }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   245
        } finally {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   246
            deleteDirectory(module);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   247
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   248
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   249
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   250
    @Test(enabled = true)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   251
    public void testSectionsAreFiles() throws IOException {
41352
f9844bad9052 8166860: Add magic number to jmod file
mchung
parents: 40261
diff changeset
   252
        String moduleName = "hacked4";
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   253
        Path jmod = helper.generateDefaultJModule(moduleName).assertSuccess();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   254
        JImageGenerator.addFiles(jmod,
43729
21db38703675 8174739: Rename JMOD section name for native libraries from native to lib
mchung
parents: 43712
diff changeset
   255
                new InMemoryFile("/lib", new byte[0]),
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   256
                new InMemoryFile("/conf", new byte[0]),
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   257
                new InMemoryFile("/bin", new byte[0]));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   258
        try {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   259
            Result result = helper.generateDefaultImage(moduleName);
41352
f9844bad9052 8166860: Add magic number to jmod file
mchung
parents: 40261
diff changeset
   260
            System.err.println(result.getMessage());
f9844bad9052 8166860: Add magic number to jmod file
mchung
parents: 40261
diff changeset
   261
            if (result.getExitCode() == 0) {
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   262
                throw new AssertionError("Crash expected");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   263
            }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   264
        } finally {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   265
            deleteDirectory(jmod);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   266
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   267
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   268
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   269
    public void testDuplicateModule1() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   270
        String moduleName1 = "dupRes1Jmod1";
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   271
        String moduleName2 = "dupRes1Jmod2";
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   272
        List<String> classNames = Arrays.asList("java.A", "javax.B");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   273
        Path module1 = helper.generateModuleCompiledClasses(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   274
                helper.getJmodSrcDir(), helper.getJmodClassesDir(), moduleName1, classNames);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   275
        Path module2 = helper.generateModuleCompiledClasses(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   276
                helper.getJmodSrcDir(), helper.getJmodClassesDir(), moduleName2, classNames);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   277
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   278
        try (OutputStream out = Files.newOutputStream(module2.resolve("module-info.class"))) {
43712
5dfd0950317c 8173393: Module system implementation refresh (2/2017)
alanb
parents: 42338
diff changeset
   279
            ModuleInfoWriter.write(ModuleDescriptor.newModule(moduleName1)
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   280
                    .requires("java.base").build(), out);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   281
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   282
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   283
        Path jmod1 = JImageGenerator.getJModTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   284
                .addClassPath(module1)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   285
                .jmod(helper.createNewJmodFile(moduleName1))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   286
                .create()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   287
                .assertSuccess();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   288
        Path jmod2 = JImageGenerator.getJModTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   289
                .addClassPath(module2)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   290
                .jmod(helper.createNewJmodFile(moduleName2))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   291
                .create()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   292
                .assertSuccess();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   293
        try {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   294
            helper.generateDefaultImage(moduleName1)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   295
                    .assertFailure("Error: Two versions of module dupRes1Jmod1 found in");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   296
        } finally {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   297
            deleteDirectory(jmod1);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   298
            deleteDirectory(jmod2);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   299
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   300
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   301
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   302
    public void testDuplicateModule2() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   303
        String moduleName = "dupRes2Jmod";
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   304
        List<String> classNames = Arrays.asList("java.A", "javax.B");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   305
        Path module1 = helper.generateModuleCompiledClasses(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   306
                helper.getJmodSrcDir(), helper.getJmodClassesDir(), moduleName, classNames);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   307
        Path module2 = helper.generateModuleCompiledClasses(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   308
                helper.getJarSrcDir(), helper.getJarClassesDir(), moduleName, classNames);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   309
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   310
        Path jmod = JImageGenerator.getJModTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   311
                .addClassPath(module1)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   312
                .jmod(helper.createNewJmodFile(moduleName))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   313
                .create()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   314
                .assertSuccess();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   315
        Path jar = JImageGenerator.createJarFile(helper.getJarDir().resolve(moduleName + ".jar"), module2);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   316
        Path newJar = helper.getJmodDir().resolve(jar.getFileName());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   317
        Files.move(jar, newJar);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   318
        try {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   319
            helper.generateDefaultImage(moduleName)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   320
                    .assertFailure("Error: Two versions of module dupRes2Jmod found in");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   321
        } finally {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   322
            deleteDirectory(jmod);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   323
            deleteDirectory(newJar);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   324
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   325
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   326
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   327
    public void testDuplicateModule3() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   328
        String moduleName1 = "dupRes3Jar1";
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   329
        String moduleName2 = "dupRes3Jar2";
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   330
        List<String> classNames = Arrays.asList("java.A", "javax.B");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   331
        Path module1 = helper.generateModuleCompiledClasses(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   332
                helper.getJarSrcDir(), helper.getJarClassesDir(), moduleName1, classNames);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   333
        Path module2 = helper.generateModuleCompiledClasses(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   334
                helper.getJarSrcDir(), helper.getJarClassesDir(), moduleName2, classNames);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   335
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   336
        try (OutputStream out = Files.newOutputStream(module2.resolve("module-info.class"))) {
43712
5dfd0950317c 8173393: Module system implementation refresh (2/2017)
alanb
parents: 42338
diff changeset
   337
            ModuleInfoWriter.write(ModuleDescriptor.newModule(moduleName1)
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   338
                    .requires("java.base").build(), out);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   339
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   340
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   341
        Path jar1 = JImageGenerator.createJarFile(helper.getJarDir().resolve(moduleName1 + ".jar"), module1);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   342
        Path jar2 = JImageGenerator.createJarFile(helper.getJarDir().resolve(moduleName2 + ".jar"), module2);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   343
        try {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   344
            helper.generateDefaultImage(moduleName1)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   345
                    .assertFailure("Error: Two versions of module dupRes3Jar1 found in");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   346
        } finally {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   347
            deleteDirectory(jar1);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   348
            deleteDirectory(jar2);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   349
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   350
    }
43796
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   351
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   352
    public void testInconsistentModuleInfo() throws IOException {
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   353
        String moduleName = "inconsistentJar";
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   354
        List<String> classNames = Arrays.asList("xorg.acme.internal.B");
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   355
        Path module = helper.generateModuleCompiledClasses(
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   356
                helper.getJarSrcDir(), helper.getJarClassesDir(), moduleName, classNames);
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   357
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   358
        try (OutputStream out = Files.newOutputStream(module.resolve("module-info.class"))) {
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   359
            ModuleInfoWriter.write(ModuleDescriptor.newModule(moduleName)
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   360
                    .requires("java.base")
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   361
                    .packages(Set.of("org.acme.internal"))
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   362
                    .build(), out);
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   363
        }
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   364
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   365
        Path jar = JImageGenerator.createJarFile(helper.getJarDir().resolve(moduleName + ".jar"), module);
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   366
        try {
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   367
            helper.generateDefaultImage(moduleName)
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   368
                  .assertFailure("Module inconsistentJar's descriptor indicates the set of packages is : " +
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   369
                  "[org.acme.internal], but module contains packages: [xorg.acme.internal]");
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   370
        } finally {
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   371
            deleteDirectory(jar);
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   372
        }
c204d2d789dc 8174718: "Module <name>'s descriptor returns inconsistent package set" confusing
sundar
parents: 43729
diff changeset
   373
    }
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   374
}