1 /*
2 * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
691
692 if (TestUtil.onWindows()) {
693 log.println("WARNING: Cannot test FileChannel transfer operations"
694 + " on Windows");
695 } else {
696 test(diskFileChannelFactory, TRANSFER_TO);
697 test(diskFileChannelFactory, TRANSFER_FROM);
698 }
699 if (fifoFile != null)
700 test(fifoFileChannelFactory);
701
702 // Testing positional file reads and writes is impractical: It requires
703 // access to a large file soft-mounted via NFS, and even then isn't
704 // completely guaranteed to work.
705 //
706 // Testing map is impractical and arguably unnecessary: It's
707 // unclear under what conditions mmap(2) will actually block.
708
709 test(connectedSocketChannelFactory);
710
711 if (TestUtil.onWindows() || TestUtil.onSolaris()) {
712 log.println("WARNING Cannot reliably test connect/finishConnect"
713 + " operations on this platform");
714 } else {
715 // Only the following tests need refuser's connection backlog
716 // to be saturated
717 ExecutorService pumperExecutor =
718 Executors.newSingleThreadExecutor(
719 new ThreadFactory() {
720
721 @Override
722 public Thread newThread(Runnable r) {
723 Thread t = new Thread(r);
724 t.setDaemon(true);
725 t.setName("Pumper");
726 return t;
727 }
728 });
729
730 pumpDone = false;
731 try {
|
1 /*
2 * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
691
692 if (TestUtil.onWindows()) {
693 log.println("WARNING: Cannot test FileChannel transfer operations"
694 + " on Windows");
695 } else {
696 test(diskFileChannelFactory, TRANSFER_TO);
697 test(diskFileChannelFactory, TRANSFER_FROM);
698 }
699 if (fifoFile != null)
700 test(fifoFileChannelFactory);
701
702 // Testing positional file reads and writes is impractical: It requires
703 // access to a large file soft-mounted via NFS, and even then isn't
704 // completely guaranteed to work.
705 //
706 // Testing map is impractical and arguably unnecessary: It's
707 // unclear under what conditions mmap(2) will actually block.
708
709 test(connectedSocketChannelFactory);
710
711 if (TestUtil.onWindows()) {
712 log.println("WARNING Cannot reliably test connect/finishConnect"
713 + " operations on this platform");
714 } else {
715 // Only the following tests need refuser's connection backlog
716 // to be saturated
717 ExecutorService pumperExecutor =
718 Executors.newSingleThreadExecutor(
719 new ThreadFactory() {
720
721 @Override
722 public Thread newThread(Runnable r) {
723 Thread t = new Thread(r);
724 t.setDaemon(true);
725 t.setName("Pumper");
726 return t;
727 }
728 });
729
730 pumpDone = false;
731 try {
|