You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by om...@apache.org on 2016/07/09 04:25:17 UTC

[1/2] orc git commit: ORC-80. C++ build breaks due to warnings with gcc-4.9

Repository: orc
Updated Branches:
  refs/heads/master 8226f23cf -> 24bf8e528


ORC-80. C++ build breaks due to warnings with gcc-4.9

Fixes #46.

Signed-off-by: Owen O'Malley <om...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/orc/repo
Commit: http://git-wip-us.apache.org/repos/asf/orc/commit/2356c7cb
Tree: http://git-wip-us.apache.org/repos/asf/orc/tree/2356c7cb
Diff: http://git-wip-us.apache.org/repos/asf/orc/diff/2356c7cb

Branch: refs/heads/master
Commit: 2356c7cb049659598a47aabb6cb7cc82feef4733
Parents: 8226f23
Author: Deepak Majeti <de...@hpe.com>
Authored: Wed Jul 6 17:03:32 2016 -0400
Committer: Owen O'Malley <om...@apache.org>
Committed: Fri Jul 8 21:24:04 2016 -0700

----------------------------------------------------------------------
 tools/test/ToolTest.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/orc/blob/2356c7cb/tools/test/ToolTest.cc
----------------------------------------------------------------------
diff --git a/tools/test/ToolTest.cc b/tools/test/ToolTest.cc
index 3a90c06..8695a9f 100644
--- a/tools/test/ToolTest.cc
+++ b/tools/test/ToolTest.cc
@@ -115,7 +115,7 @@ int runProgram(const std::vector<std::string>& command,
     argv[command.size()] = 0;
 
     // do the stdout & stderr redirection
-    int stdoutFd = open(stdoutName, O_WRONLY | O_CREAT | O_TRUNC);
+    int stdoutFd = open(stdoutName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
     if (stdoutFd == -1) {
       std::cerr << "Failed to open " << stdoutName << " - "
                 << strerror(errno) << "\n";
@@ -126,7 +126,7 @@ int runProgram(const std::vector<std::string>& command,
       exit(1);
     }
     close(stdoutFd);
-    int stderrFd = open(stderrName, O_WRONLY | O_CREAT | O_TRUNC);
+    int stderrFd = open(stderrName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
     if (stderrFd == -1) {
       std::cerr << "Failed to open " << stderrName << " - "
                 << strerror(errno) << "\n";
@@ -163,7 +163,7 @@ int runProgram(const std::vector<std::string>& command,
     if (result == -1) {
       std::cerr << "Error: " << strerror(errno) << "\n";
     } else if (WIFSIGNALED(status)) {
-      std::cerr << "Fatal signal: " << WTERMSIG(signal) << "\n";
+      std::cerr << "Fatal signal: " << WTERMSIG(status) << "\n";
     }
     exit(1);
   }


[2/2] orc git commit: ORC-82. Compilation fix for ubuntu 12.

Posted by om...@apache.org.
ORC-82. Compilation fix for ubuntu 12.

Signed-off-by: Owen O'Malley <om...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/orc/repo
Commit: http://git-wip-us.apache.org/repos/asf/orc/commit/24bf8e52
Tree: http://git-wip-us.apache.org/repos/asf/orc/tree/24bf8e52
Diff: http://git-wip-us.apache.org/repos/asf/orc/diff/24bf8e52

Branch: refs/heads/master
Commit: 24bf8e528b2d94710db2b91d380079307c1a939b
Parents: 2356c7c
Author: Owen O'Malley <om...@apache.org>
Authored: Thu Jul 7 22:44:11 2016 -0700
Committer: Owen O'Malley <om...@apache.org>
Committed: Fri Jul 8 21:24:43 2016 -0700

----------------------------------------------------------------------
 CMakeLists.txt             |  7 ++--
 tools/test/TestFileScan.cc | 77 ++++++++++++++++++++++++++++++++++-------
 2 files changed, 67 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/orc/blob/24bf8e52/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0b3d831..3c75ce0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,6 +71,7 @@ set (ZLIB_LIBRARIES zlib)
 set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
 set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
+message(STATUS "compiler ${CMAKE_CXX_COMPILER_ID} version ${CMAKE_CXX_COMPILER_VERSION}")
 if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
   set (CXX11_FLAGS "-std=c++11")
   set (WARN_FLAGS "-Weverything -Wno-c++98-compat -Wno-missing-prototypes")
@@ -80,10 +81,8 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
   set (WARN_FLAGS "${WARN_FLAGS} -Wconversion -Werror")
 elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
   set (WARN_FLAGS "-Wall -Wno-unknown-pragmas -Wconversion -Werror")
-  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.3")
-    set (CXX11_FLAGS "")
-    set (WARN_FLAGS "-Wformat -Werror")
-  elseif (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
+  if (CMAKE_CXX_COMPILER_VERSION STREQUAL "" OR
+      CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
     set (CXX11_FLAGS "-std=c++0x")
   else ()
     set (CXX11_FLAGS "-std=c++11")

http://git-wip-us.apache.org/repos/asf/orc/blob/24bf8e52/tools/test/TestFileScan.cc
----------------------------------------------------------------------
diff --git a/tools/test/TestFileScan.cc b/tools/test/TestFileScan.cc
index 586102c..c8b5fe8 100644
--- a/tools/test/TestFileScan.cc
+++ b/tools/test/TestFileScan.cc
@@ -34,53 +34,104 @@ TEST (TestFileScan, testNominal) {
   EXPECT_EQ("Rows: 32768\nBatches: 33\n", output);
   EXPECT_EQ("", error);
 
-  EXPECT_EQ(0, runProgram({pgm, "-b", "256", file}, output, error));
+  EXPECT_EQ(0, runProgram({pgm, std::string("-b"), std::string("256"), file},
+                          output, error));
   EXPECT_EQ("Rows: 32768\nBatches: 131\n", output);
   EXPECT_EQ("", error);
 
-  EXPECT_EQ(0, runProgram({pgm, "-b256", file}, output, error));
+  EXPECT_EQ(0, runProgram({pgm, std::string("-b256"), file}, output, error));
   EXPECT_EQ("Rows: 32768\nBatches: 131\n", output);
   EXPECT_EQ("", error);
 
-  EXPECT_EQ(0, runProgram({pgm, "--batch", "256", file}, output, error));
+  EXPECT_EQ(0, runProgram({pgm, std::string("--batch"), std::string("256"),
+          file}, output, error));
   EXPECT_EQ("Rows: 32768\nBatches: 131\n", output);
   EXPECT_EQ("", error);
 
-  EXPECT_EQ(0, runProgram({pgm, "--batch=256", file}, output, error));
+  EXPECT_EQ(0, runProgram({pgm, std::string("--batch=256"), file},
+                          output, error));
   EXPECT_EQ("Rows: 32768\nBatches: 131\n", output);
   EXPECT_EQ("", error);
 }
 
+/**
+ * This function locates the goal substring in the input and removes
+ * everything before it.
+ * stripPrefix("abcdef", "cd") -> "cdef"
+ * stripPrefix("abcdef", "xx") -> "abcdef"
+ */
+std::string stripPrefix(const std::string& input, const std::string goal) {
+  size_t loc = input.find(goal);
+  if (loc == std::string::npos) {
+    return input;
+  } else {
+    return input.substr(loc);
+  }
+}
+
+std::string removeChars(const std::string &input,
+                        const std::string& chars) {
+  std::string result;
+  size_t prev = 0;
+  size_t pos = input.find_first_of(chars);
+  while (pos != std::string::npos) {
+    if (pos > prev) {
+      result += input.substr(prev, pos - prev);
+    }
+    prev = pos + 1;
+    pos = input.find_first_of(chars, prev);
+  }
+  pos = input.length();
+  if (pos > prev) {
+    result += input.substr(prev, pos - prev);
+  }
+  return result;
+}
+
+TEST (TestFileScan, testRemoveChars) {
+  EXPECT_EQ("abcdef", removeChars("abcdef", "xyz"));
+  EXPECT_EQ("bbbddd", removeChars("aaabbbcccddd", "ca"));
+  EXPECT_EQ("aaaccc", removeChars("aaabbbcccddd", "bd"));
+  EXPECT_EQ("abcde", removeChars("axbxcxdxe", "x"));
+}
+
 TEST (TestFileScan, testBadCommand) {
   const std::string pgm = findProgram("tools/src/orc-scan");
   const std::string file = findExample("TestOrcFile.testSeek.orc");
   std::string output;
   std::string error;
-  EXPECT_EQ(1, runProgram({pgm, file, "-b"}, output, error));
+  EXPECT_EQ(1, runProgram({pgm, file, std::string("-b")}, output, error));
   EXPECT_EQ("", output);
   EXPECT_EQ("orc-scan: option requires an argument -- b\n"
             "Usage: orc-scan [-h] [--help]\n"
-            "                [-b<size>] [--batch=<size>] <filename>\n", error);
+            "                [-b<size>] [--batch=<size>] <filename>\n",
+            removeChars(stripPrefix(error, "orc-scan: "),"'`"));
 
-  EXPECT_EQ(1, runProgram({pgm, file, "-b", "20x"}, output, error));
+  EXPECT_EQ(1, runProgram({pgm, file, std::string("-b"),
+          std::string("20x")}, output, error));
   EXPECT_EQ("", output);
   EXPECT_EQ("The --batch parameter requires an integer option.\n", error);
 
-  EXPECT_EQ(1, runProgram({pgm, file, "-b", "x30"}, output, error));
+  EXPECT_EQ(1, runProgram({pgm, file, std::string("-b"),
+          std::string("x30")}, output, error));
   EXPECT_EQ("", output);
   EXPECT_EQ("The --batch parameter requires an integer option.\n", error);
 
-  EXPECT_EQ(1, runProgram({pgm, file, "--batch"}, output, error));
+  EXPECT_EQ(1, runProgram({pgm, file, std::string("--batch")},
+                          output, error));
   EXPECT_EQ("", output);
-  EXPECT_EQ("orc-scan: option `--batch' requires an argument\n"
+  EXPECT_EQ("orc-scan: option --batch requires an argument\n"
             "Usage: orc-scan [-h] [--help]\n"
-            "                [-b<size>] [--batch=<size>] <filename>\n", error);
+            "                [-b<size>] [--batch=<size>] <filename>\n",
+            removeChars(stripPrefix(error, "orc-scan: "), "'`"));
 
-  EXPECT_EQ(1, runProgram({pgm, file, "--batch", "20x"}, output, error));
+  EXPECT_EQ(1, runProgram({pgm, file, std::string("--batch"),
+          std::string("20x")}, output, error));
   EXPECT_EQ("", output);
   EXPECT_EQ("The --batch parameter requires an integer option.\n", error);
 
-  EXPECT_EQ(1, runProgram({pgm, file, "--batch", "x30"}, output, error));
+  EXPECT_EQ(1, runProgram({pgm, file, std::string("--batch"),
+            std::string("x30")}, output, error));
   EXPECT_EQ("", output);
   EXPECT_EQ("The --batch parameter requires an integer option.\n", error);
 }