8355444: [java.io] Use @requires tag instead of exiting based on "os.name" property value
Reviewed-by: jpai, lancea
This commit is contained in:
parent
01fd49ffb3
commit
5faa559022
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -21,6 +21,11 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This test is launched via a ProcessBuilder in the main test MacPath which
|
||||||
|
* includes a @requires (os.family == "mac") tag so no operating system
|
||||||
|
* conditional is applied here.
|
||||||
|
*/
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@ -29,10 +34,6 @@ import java.text.Normalizer;
|
|||||||
public class MacPathTest {
|
public class MacPathTest {
|
||||||
|
|
||||||
public static void main(String args[]) throws Throwable {
|
public static void main(String args[]) throws Throwable {
|
||||||
String osname = System.getProperty("os.name");
|
|
||||||
if (!osname.contains("OS X") && !osname.contains("Darwin"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// English
|
// English
|
||||||
test("TestDir_apple", // test dir
|
test("TestDir_apple", // test dir
|
||||||
"dir_macosx", // dir
|
"dir_macosx", // dir
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,16 +24,21 @@
|
|||||||
/* @test
|
/* @test
|
||||||
@bug 6481955
|
@bug 6481955
|
||||||
@summary Path length less than MAX_PATH (260) works on Windows
|
@summary Path length less than MAX_PATH (260) works on Windows
|
||||||
|
@library /test/lib
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import jtreg.SkippedException;
|
||||||
|
|
||||||
public class MaxPath {
|
public class MaxPath {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
String osName = System.getProperty("os.name");
|
String osName = System.getProperty("os.name");
|
||||||
if (!osName.startsWith("Windows")) {
|
if (!osName.startsWith("Windows")) {
|
||||||
return;
|
throw new SkippedException("This test is run only on Windows");
|
||||||
}
|
}
|
||||||
|
|
||||||
int MAX_PATH = 260;
|
int MAX_PATH = 260;
|
||||||
String dir = new File(".").getAbsolutePath() + "\\";
|
String dir = new File(".").getAbsolutePath() + "\\";
|
||||||
String padding = "1234567890123456789012345678901234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890";
|
String padding = "1234567890123456789012345678901234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,6 +24,7 @@
|
|||||||
/* @test
|
/* @test
|
||||||
@bug 6176051 4858457
|
@bug 6176051 4858457
|
||||||
@summary Check whether reserved names are handled correctly on Windows
|
@summary Check whether reserved names are handled correctly on Windows
|
||||||
|
@requires (os.family == "windows")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -38,10 +39,6 @@ public class WinDeviceName {
|
|||||||
};
|
};
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String osName = System.getProperty("os.name");
|
String osName = System.getProperty("os.name");
|
||||||
if (!osName.startsWith("Windows")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < devnames.length; i++) {
|
for (int i = 0; i < devnames.length; i++) {
|
||||||
String names[] = { devnames[i], devnames[i] + ".TXT",
|
String names[] = { devnames[i], devnames[i] + ".TXT",
|
||||||
devnames[i].toLowerCase(),
|
devnames[i].toLowerCase(),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,15 +25,12 @@
|
|||||||
@bug 6384833
|
@bug 6384833
|
||||||
@summary Check if appropriate exception FileNotFoundException gets
|
@summary Check if appropriate exception FileNotFoundException gets
|
||||||
thrown when the pathlengh exceeds the limit.
|
thrown when the pathlengh exceeds the limit.
|
||||||
|
@requires (os.family == "windows")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
public class WinMaxPath {
|
public class WinMaxPath {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
String osName = System.getProperty("os.name");
|
|
||||||
if (!osName.startsWith("Windows")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
char[] as = new char[65000];
|
char[] as = new char[65000];
|
||||||
java.util.Arrays.fill(as, 'a');
|
java.util.Arrays.fill(as, 'a');
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,15 +25,12 @@
|
|||||||
@bug 6192331 6348207 8202076
|
@bug 6192331 6348207 8202076
|
||||||
@summary Check if File.exists()/length() works correctly on Windows
|
@summary Check if File.exists()/length() works correctly on Windows
|
||||||
special files hiberfil.sys and pagefile.sys
|
special files hiberfil.sys and pagefile.sys
|
||||||
|
@requires (os.family == "windows")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
public class WinSpecialFiles {
|
public class WinSpecialFiles {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
String osName = System.getProperty("os.name");
|
|
||||||
if (!osName.startsWith("Windows")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
File root = new File("C:\\");
|
File root = new File("C:\\");
|
||||||
File[] dir = root.listFiles();
|
File[] dir = root.listFiles();
|
||||||
for (int i = 0; i < dir.length; i++) {
|
for (int i = 0; i < dir.length; i++) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -37,15 +37,6 @@ public class ManyFiles {
|
|||||||
static int NUM_FILES = 2050;
|
static int NUM_FILES = 2050;
|
||||||
|
|
||||||
public static void main(String args[]) throws Exception {
|
public static void main(String args[]) throws Exception {
|
||||||
// Linux does not yet allow opening this many files; Solaris
|
|
||||||
// 8 requires an explicit allocation of more file descriptors
|
|
||||||
// to succeed. Since this test is written to check for a
|
|
||||||
// Windows capability it is much simpler to only run it
|
|
||||||
// on that platform.
|
|
||||||
String osName = System.getProperty("os.name");
|
|
||||||
if (osName.startsWith("Linux"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (int n = 0; n < NUM_FILES; n++) {
|
for (int n = 0; n < NUM_FILES; n++) {
|
||||||
File f = new File("file" + count++);
|
File f = new File("file" + count++);
|
||||||
files.add(f);
|
files.add(f);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user