Skip to content
Snippets Groups Projects
Commit 52ae0d45 authored by Florian Angerer's avatar Florian Angerer
Browse files

Fixed unit test issue: Used the system temp path in a test case which is...

Fixed unit test issue: Used the system temp path in a test case which is different for other platforms.
Sorry for that.
parent c94d0700
No related branches found
No related tags found
No related merge requests found
......@@ -21071,19 +21071,6 @@ Levels: c f h k m n p x
[1000] 1
Levels: 0 1
 
##com.oracle.truffle.r.test.builtins.TestBuiltin_fifoConnection.testFifoOpenInexisting#
#capabilities("fifo")
fifo
TRUE
##com.oracle.truffle.r.test.builtins.TestBuiltin_fifoConnection.testFifoOpenInexisting#Output.IgnoreErrorContext#Output.IgnoreWarningContext#
#{ zz <- fifo("/tmp/pipe3408688236", "r", blocking = TRUE); close(zz); }
Error in fifo("/tmp/pipe3408688236", "r", blocking = TRUE) :
cannot open the connection
In addition: Warning message:
In fifo("/tmp/pipe3408688236", "r", blocking = TRUE) :
cannot open fifo '/tmp/pipe3408688236'
##com.oracle.truffle.r.test.builtins.TestBuiltin_fileaccess.testfileaccess1#
#argv <- list(character(0), 0); .Internal(file.access(argv[[1]], argv[[2]]))
integer(0)
......@@ -73691,6 +73678,17 @@ Error in file("", "w+", encoding = "___inexistingCharSet___") :
#{ wline <- 'Hellö'; fin <- file('', 'w+', encoding = 'UTF-8'); writeLines(wline, fin); seek(fin, 0); rline <- readLines(fin, 1); close(fin); c(wline, rline, wline == rline) }
[1] "Hellö" "Hellö" "TRUE"
 
##com.oracle.truffle.r.test.library.base.TestConnections.testFifoOpenInexisting#
#capabilities("fifo")
fifo
TRUE
##com.oracle.truffle.r.test.library.base.TestConnections.testFifoOpenInexisting#Output.IgnoreErrorContext#Output.IgnoreWarningContext#
#{ fn <- '___fifo_2367253765'; zz <- fifo(fn, 'r', blocking = TRUE); close(zz); unlink(fn) }
Error in fifo(fn, "r", blocking = TRUE) : cannot open the connection
In addition: Warning message:
In fifo(fn, "r", blocking = TRUE) : cannot open fifo '___fifo_2367253765'
##com.oracle.truffle.r.test.library.base.TestConnections.testFileOpenRaw#
#{ zz <- file("gzipped_____5137528280012599068___.gz", "r", raw=T); res <- readBin(zz, raw(), 4); close(zz); res }
Error in readBin(zz, raw(), 4) : can only read from a binary connection
/*
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.truffle.r.test.builtins;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import com.oracle.truffle.r.test.TestBase;
// Checkstyle: stop line length check
public class TestBuiltin_fifoConnection extends TestBase {
private static List<Path> TEMP_FIFOS = new ArrayList<>();
@BeforeClass
public static void setup() {
Path path = Paths.get(System.getProperty("java.io.tmpdir"));
TEMP_FIFOS.add(path.resolve("pipe3408688236"));
TEMP_FIFOS.add(path.resolve("pipe4039819292"));
}
@Test
public void testFifoOpenInexisting() {
assertEval("capabilities(\"fifo\")");
Assert.assertFalse(Files.exists(TEMP_FIFOS.get(0)));
assertEval(Output.IgnoreErrorContext, Output.IgnoreWarningContext, "{ zz <- fifo(\"" + TEMP_FIFOS.get(0) + "\", \"r\", blocking = TRUE); close(zz); }");
}
@Test(timeout = 100)
@Ignore
public void testFifoOpenNonBlocking() {
Assert.assertFalse(Files.exists(TEMP_FIFOS.get(0)));
assertEval(Ignored.ImplementationError, "{ zz <- fifo(\"" + TEMP_FIFOS.get(0) + "\", \"r\"); close(zz); }");
}
@AfterClass
public static void cleanup() {
for (Path p : TEMP_FIFOS) {
try {
Files.delete(p);
} catch (IOException e) {
// ignore
}
}
}
}
......@@ -234,6 +234,12 @@ public class TestConnections extends TestRBase {
assertEval("{ zz <- rawConnection(raw(0), \"wb\"); x <- c(\"a\", \"this will be truncated\", \"abc\"); nc <- c(3, 10, 3); writeChar(x, zz, nc, eos = NULL); writeChar(x, zz, eos = \"\\r\\n\"); res <- rawConnectionValue(zz); close(zz); res }");
}
@Test
public void testFifoOpenInexisting() {
assertEval("capabilities(\"fifo\")");
assertEval(Output.IgnoreErrorContext, Output.IgnoreWarningContext, "{ fn <- '___fifo_2367253765'; zz <- fifo(fn, 'r', blocking = TRUE); close(zz); unlink(fn) }");
}
private static final String[] LVAL = arr("T", "F");
private static String[] arr(String... args) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment