You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mnemonic.apache.org by ga...@apache.org on 2017/03/01 06:36:42 UTC

incubator-mnemonic git commit: MNEMONIC-200: Rewrite runall script in Python

Repository: incubator-mnemonic
Updated Branches:
  refs/heads/master 2edeb55cf -> c5dc245d7


MNEMONIC-200: Rewrite runall script in Python


Project: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/commit/c5dc245d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/tree/c5dc245d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/diff/c5dc245d

Branch: refs/heads/master
Commit: c5dc245d7ccb14c0da6f6c84dbb98ef53eaa408c
Parents: 2edeb55
Author: paley <pa...@gmail.com>
Authored: Tue Feb 28 20:05:59 2017 -0800
Committer: paley <pa...@gmail.com>
Committed: Tue Feb 28 22:29:29 2017 -0800

----------------------------------------------------------------------
 build-tools/runTestCases.py | 42 ++++++++++++++++++++
 build-tools/runall.sh       | 83 +---------------------------------------
 build-tools/test.conf       | 44 +++++++++++++++++++++
 3 files changed, 87 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/c5dc245d/build-tools/runTestCases.py
----------------------------------------------------------------------
diff --git a/build-tools/runTestCases.py b/build-tools/runTestCases.py
new file mode 100644
index 0000000..e2e097d
--- /dev/null
+++ b/build-tools/runTestCases.py
@@ -0,0 +1,42 @@
+#! /usr/bin/env python
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import re
+import subprocess
+import sys
+
+testCmdFile = 'build-tools/test.conf'
+tcCmdReg = re.compile('^mvn\s.*$')
+tcNameReg = re.compile('-Dtest=(.+?)\s')
+tcModuleReg = re.compile('-pl\s(.+?)\s')
+with open(testCmdFile) as fp:
+    for line in fp:
+        match = tcCmdReg.findall(line)
+        if match:
+            logFilePath = "testlog/" + tcNameReg.findall(line)[0] + ".log"
+            print("[INFO] Running " + tcNameReg.findall(line)[0] + " test case for \"" + tcModuleReg.findall(line)[0] + "\"...")
+            try:
+                #maven build
+                subprocess.check_call(match[0] + ">" + logFilePath, stderr=subprocess.STDOUT, shell=True)
+                print("[SUCCESS] Test case " + tcNameReg.findall(line)[0] + " for \"" + tcModuleReg.findall(line)[0]+ "\" is completed!")
+            except subprocess.CalledProcessError as e:
+                print("[ERROR] This test case requires \"pmalloc\" memory service to pass, please check if \"pmalloc\" has been configured correctly! If \"pmalloc\" is installed, please refer to testlog/" + tcNameReg.findall(line)[0] + ".log for detailed information.")
+                sys.exit(1)
+print("[DONE] All test cases are completed! Log files are available under folder testlog!")
+

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/c5dc245d/build-tools/runall.sh
----------------------------------------------------------------------
diff --git a/build-tools/runall.sh b/build-tools/runall.sh
index 83931a3..782d9f1 100755
--- a/build-tools/runall.sh
+++ b/build-tools/runall.sh
@@ -47,87 +47,6 @@ exit 1
 fi
 echo [SUCCESS] Mnemonic example is completed!
 
-echo [INFO] Running DurablePersonNGTest test case for \"mnemonic-core\"...
-mvn -Dtest=DurablePersonNGTest test -pl mnemonic-core -DskipTests=false > testlog/DurablePersonNGTest.log
-if [ $? -gt 0 ]
-then
-echo [ERROR] This test case requires \"pmalloc\" memory service to pass, please check if \"pmalloc\" has been configured correctly! If \"pmalloc\" is installed, please refer to testlog/DurablePersonNGTest.log for detailed information.
-exit 1
-fi
-echo [SUCCESS] Test case DurablePersonNGTest for \"mnemonic-core\" is completed!
-
-echo [INFO] Running NonVolatileMemAllocatorNGTest test case for \"mnemonic-core\"...
-mvn -Dtest=NonVolatileMemAllocatorNGTest test -pl mnemonic-core -DskipTests=false > testlog/NonVolatileMemAllocatorNGTest.log
-if [ $? -gt 0 ]
-then
-echo [ERROR] This test case requires \"pmalloc\" memory service to pass, please check if \"pmalloc\" has been configured correctly! If \"pmalloc\" is installed, please refer to testlog/NonVolatileMemAllocatorNGTest.log for detailed information.
-exit 1
-fi
-echo [SUCCESS] Test case NonVolatileMemAllocatorNGTest for \"mnemonic-core\" is completed!
-
-echo [INFO] Running VolatileMemAllocatorNGTest test case of \"mnemonic-core\"...
-mvn -Dtest=VolatileMemAllocatorNGTest test -pl mnemonic-core -DskipTests=false > testlog/VolatileMemAllocatorNGTest.log
-if [ $? -gt 0 ]
-then
-echo [ERROR] This example requires \"vmem\" memory service to run, please check if \"vmem\" has been configured correctly! If \"vmem\" is installed, please refer to testlog/VolatileMemAllocatorNGTest.log for detailed information.
-exit 1
-fi
-echo [SUCCESS] Test case VolatileMemAllocatorNGTest for \"mnemonic-core\" is completed!
-
-echo [INFO] Running MemClusteringNGTest for \"mnemonic-core\"...
-mvn -Dtest=MemClusteringNGTest test -pl mnemonic-core -DskipTests=false > testlog/MemClusteringNGTest.log
-if [ $? -gt 0 ]
-then
-echo [ERROR] This example requires \"vmem\" memory service to run, please check if \"vmem\" has been configured correctly! If \"vmem\" is installed, please refer to testlog/MemClusteringNGTest.log for detailed information.
-exit 1
-fi
-echo [SUCCESS] Test case MemClusteringNGTest for \"mnemonic-core\" is completed!
-
-echo [INFO] Running DurableSinglyLinkedListNGTest for \"mnemonic-collection\"...
-mvn -Dtest=DurableSinglyLinkedListNGTest  test -pl mnemonic-collections -DskipTests=false > testlog/DurableSinglyLinkedListNGTest.log
-if [ $? -gt 0 ]
-then
-echo [ERROR] This test case requires \"pmalloc\" memory service to pass, please check if \"pmalloc\" has been configured correctly! If \"pmalloc\" is installed, please refer to testlog/DurableSinglyLinkedListNGTest.log for detailed information.
-exit 1
-fi
-echo [SUCCESS] Test case DurableSinglyLinkedListNGTest for \"mnemonic-collection\" is completed!
-
-echo [INFO] Running DurablePersonNGTest for \"mnemonic-collection\"...
-mvn -Dtest=DurablePersonNGTest  test -pl mnemonic-collections -DskipTests=false > testlog/DurablePersonNGTest.log
-if [ $? -gt 0 ]
-then
-echo [ERROR] This test case requires \"pmalloc\" memory service to pass, please check if \"pmalloc\" has been configured correctly! If \"pmalloc\" is installed, please refer to testlog/DurablePersonNGTest.log for detailed information.
-exit 1
-fi
-echo [SUCCESS] Test case DurablePersonNGTest for \"mnemonic-collection\" is completed!
-
-echo [INFO] Running DurableSinglyLinkedListNGPrintTest for \"mnemonic-computing-services/mnemonic-utilities-service\"...
-mvn -Dtest=DurableSinglyLinkedListNGPrintTest test -pl mnemonic-computing-services/mnemonic-utilities-service -DskipTests=false > testlog/DurableSinglyLinkedListNGPrintTest.log
-if [ $? -gt 0 ]
-then
-echo [ERROR] This test case requires \"pmalloc\" memory service to pass, please check if \"pmalloc\" has been configured correctly! If \"pmalloc\" is installed, please refer to testlog/DurableSinglyLinkedListNGPrintTest.log for detailed information.
-exit 1
-fi
-echo [SUCCESS] Test case DurableSinglyLinkedListNGPrintTest for \"mnemonic-computing-services/mnemonic-utilities-service\" is completed!
-
-echo [INFO] Running DurableSinglyLinkedListNGSortTest for \"mnemonic-computing-services/mnemonic-utilities-service\"...
-mvn -Dtest=DurableSinglyLinkedListNGSortTest test -pl mnemonic-computing-services/mnemonic-utilities-service -DskipTests=false > testlog/DurableSinglyLinkedListNGSortTest.log
-if [ $? -gt 0 ]
-then
-echo [ERROR] This test case requires \"pmalloc\" memory service to pass, please check if \"pmalloc\" has been configured correctly! If \"pmalloc\" is installed, please refer to testlog/DurableSinglyLinkedListNGSortTest.log for detailed information.
-exit 1
-fi
-echo [SUCCESS] Test case DurableSinglyLinkedListNGSortTest for \"mnemonic-computing-services/mnemonic-utilities-service\" is completed!
-
-echo [INFO] Running MneMapreducePersonDataTest for \"mnemonic-hadoop/mnemonic-hadoop-mapreduce\"...
-mvn -Dtest=MneMapreducePersonDataTest test -pl mnemonic-hadoop/mnemonic-hadoop-mapreduce -DskipTests=false > testlog/MneMapreducePersonDataTest.log
-if [ $? -gt 0 ]
-then
-echo [ERROR] This test case requires \"pmalloc\" memory service to pass, please check if \"pmalloc\" has been configured correctly! If \"pmalloc\" is installed, please refer to testlog/MneMapreduceIOTest.log for detailed information.
-exit 1
-fi
-echo [SUCCESS] Test case MneMapreduceIOTest for \"mnemonic-hadoop/mnemonic-hadoop-mapreduce\" is completed!
-
-echo [DONE] All test cases are completed! Log files are available under folder testlog!
+python build-tools/runTestCases.py
 
 popd

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/c5dc245d/build-tools/test.conf
----------------------------------------------------------------------
diff --git a/build-tools/test.conf b/build-tools/test.conf
new file mode 100644
index 0000000..a3905ae
--- /dev/null
+++ b/build-tools/test.conf
@@ -0,0 +1,44 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# a testcase for module "mnemonic-core" that requires 'pmalloc' memory service to pass
+mvn -Dtest=DurablePersonNGTest test -pl mnemonic-core -DskipTests=false
+
+# a testcase for module "mnemonic-core" that requires 'pmalloc' memory service to pass
+mvn -Dtest=NonVolatileMemAllocatorNGTest test -pl mnemonic-core -DskipTests=false
+
+# a testcase for module "mnemonic-core" that requires 'vmem' memory service to pass
+mvn -Dtest=VolatileMemAllocatorNGTest test -pl mnemonic-core -DskipTests=false
+
+# a testcase for module "mnemonic-core" that requires 'vmem memory service to pass
+mvn -Dtest=MemClusteringNGTest test -pl mnemonic-core -DskipTests=false
+
+# a testcase for module "mnemonic-collection" that requires 'pmalloc' memory service to pass
+mvn -Dtest=DurableSinglyLinkedListNGTest  test -pl mnemonic-collections -DskipTests=false
+
+# a testcase for module "mnemonic-collection" that requires 'pmalloc' memory service to pass
+mvn -Dtest=DurablePersonNGTest  test -pl mnemonic-collections -DskipTests=false
+
+# a testcase for module "mnemonic-computing-services/mnemonic-utilities-service" that requires 'pmalloc' memory service to pass
+mvn -Dtest=DurableSinglyLinkedListNGPrintTest test -pl mnemonic-computing-services/mnemonic-utilities-service -DskipTests=false
+
+# a testcase for module "mnemonic-computing-services/mnemonic-utilities-service" that requires 'pmalloc' memory service to pass
+mvn -Dtest=DurableSinglyLinkedListNGSortTest test -pl mnemonic-computing-services/mnemonic-utilities-service -DskipTests=false
+
+# a testcase for module "mnemonic-hadoop/mnemonic-hadoop-mapreduce" that requires 'pmalloc' memory service to pass
+mvn -Dtest=MneMapreducePersonDataTest test -pl mnemonic-hadoop/mnemonic-hadoop-mapreduce -DskipTests=false
+