From 5c41c65fe604df947cbfe27cd0735197eff2336b Mon Sep 17 00:00:00 2001
From: Mick Jordan <mick.jordan@oracle.com>
Date: Mon, 20 Jun 2016 14:58:37 -0700
Subject: [PATCH] embedded test: set option to allow unresolved symbols on
 Linux

---
 .../truffle/r/engine/shell/StringConsoleHandler.java  |  5 -----
 .../r/nodes/builtin/base/PrettyPrinterNode.java       |  4 ++--
 com.oracle.truffle.r.test.native/embedded/Makefile    | 11 ++++++++++-
 .../oracle/truffle/r/test/generate/FastRSession.java  |  5 -----
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/StringConsoleHandler.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/StringConsoleHandler.java
index d4ae7a9942..5ec080d095 100644
--- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/StringConsoleHandler.java
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/StringConsoleHandler.java
@@ -99,11 +99,6 @@ class StringConsoleHandler implements ConsoleHandler {
         this.prompt = prompt;
     }
 
-    @Override
-    public int getWidth() {
-        return RContext.CONSOLE_WIDTH;
-    }
-
     @Override
     public String getInputDescription() {
         return inputDescription;
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PrettyPrinterNode.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PrettyPrinterNode.java
index 981eb21454..a8cf489e4d 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PrettyPrinterNode.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PrettyPrinterNode.java
@@ -526,7 +526,7 @@ public abstract class PrettyPrinterNode extends RNode {
                 maxPositionLength = intString(vector.getLength()).length();
                 leftWidth = maxPositionLength + 2; // There is [] around the number.
             }
-            int forColumns = RContext.getInstance().getConsoleHandler().getWidth() - leftWidth;
+            int forColumns = (int) RContext.getInstance().stateROptions.getValue("width") - leftWidth;
             int numberOfColumns = Math.max(1, forColumns / columnWidth);
 
             int index = 0;
@@ -1742,7 +1742,7 @@ public abstract class PrettyPrinterNode extends RNode {
                 for (; colInd < dataColWidths.length; colInd++) {
                     boolean hasNegative = dataColWidths[colInd] < 0;
                     totalWidth += Math.abs(dataColWidths[colInd]) + ((isDoubleVector || isComplexVector) && hasNegative ? 2 : 1);
-                    if (totalWidth > RContext.getInstance().getConsoleHandler().getWidth()) {
+                    if (totalWidth > (int) RContext.getInstance().stateROptions.getValue("name")) {
                         if (colInd == startColInd) {
                             // the first column is already too wide but needs to be printed
                             // nevertheless
diff --git a/com.oracle.truffle.r.test.native/embedded/Makefile b/com.oracle.truffle.r.test.native/embedded/Makefile
index c76dc44962..40f99dfb2a 100644
--- a/com.oracle.truffle.r.test.native/embedded/Makefile
+++ b/com.oracle.truffle.r.test.native/embedded/Makefile
@@ -25,6 +25,12 @@ ifeq ($(TOPDIR),)
     TOPDIR = $(abspath ..)
 endif
 
+OSNAME := $(shell uname)
+
+ifeq ($(OSNAME), Linux)
+  LD_FLAGS :=  -Wl,--unresolved-symbols=ignore-all
+endif
+
 FASTR_LIB_DIR = $(abspath ../../lib)
 
 NATIVE_PROJECT = $(subst test.native,native,$(TOPDIR))
@@ -41,11 +47,14 @@ INCLUDE_DIR := $(NATIVE_PROJECT)/include
 
 all: $(OBJ)/main
 
+$(OBJ)/main: | $(OBJ)
+
 $(OBJ):
 	mkdir -p $(OBJ)
 
+
 $(OBJ)/main: $(SRC)/main.c
-	$(CC) $(CFLAGS) -I$(INCLUDE_DIR) $< -o main -L $(FASTR_LIB_DIR) -ldl -lR
+	$(CC) $(CFLAGS) -I$(INCLUDE_DIR) $< -o $(OBJ)/main -L $(FASTR_LIB_DIR) -ldl -lR $(LD_FLAGS)
 
 clean:
 	rm -rf $(OBJ)
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java
index e8a3aaa2b9..79bc107ec6 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java
@@ -115,11 +115,6 @@ public final class FastRSession implements RSession {
             buffer.delete(0, buffer.length());
         }
 
-        @Override
-        public int getWidth() {
-            return RContext.CONSOLE_WIDTH;
-        }
-
         @Override
         public String getInputDescription() {
             return "<test input>";
-- 
GitLab