[med-svn] [vista] 04/06: Imported Upstream version 0.20140106

Luis Ibanez luisibanez-guest at moszumanska.debian.org
Tue Jan 7 00:29:01 UTC 2014


This is an automated email from the git hooks/post-receive script.

luisibanez-guest pushed a commit to branch master
in repository vista.

commit 27ea4e20f6339ccddf940ca3313e060e3a4f0765
Author: Luis Ibanez <luis.ibanez at kitware.com>
Date:   Mon Jan 6 19:23:14 2014 -0500

    Imported Upstream version 0.20140106
---
 .../Problem List/Testing/RAS/PLMain01_suite.py     | 19 ++--------------
 .../Registration/Testing/RAS/REGMain01_suite.py    | 19 ++--------------
 Packages/Scheduling/Testing/RAS/SCMain01_suite.py  | 23 ++-----------------
 Python/vista/OSEHRAHelper.py                       | 26 +++++++++++++---------
 Python/vista/TestHelper.py                         | 11 +++------
 Testing/CMakeLists.txt                             |  8 +++----
 Testing/Functional/CMakeLists.txt                  |  5 ++---
 Testing/Functional/RAS/RASTest.cmake.in            |  6 ++++-
 Testing/OTJ/OTJTestDriver.cmake.in                 |  4 ++--
 Testing/Setup/ImportRG.cmake.in                    | 12 +++++-----
 Testing/UnitTest.cmake.in                          |  4 ++--
 11 files changed, 45 insertions(+), 92 deletions(-)

diff --git a/Packages/Problem List/Testing/RAS/PLMain01_suite.py b/Packages/Problem List/Testing/RAS/PLMain01_suite.py
index d490ad7..575600f 100644
--- a/Packages/Problem List/Testing/RAS/PLMain01_suite.py	
+++ b/Packages/Problem List/Testing/RAS/PLMain01_suite.py	
@@ -730,6 +730,7 @@ def startmon(test_suite_details):
     test_driver = TestHelper.TestDriver(testname)
 
     test_driver.pre_test_run(test_suite_details)
+    VistA1 = None
     try:
         VistA1=test_driver.connect_VistA(test_suite_details)
         VistA1.startCoverage(routines=['GMPL*'])
@@ -755,6 +756,7 @@ def stopmon (test_suite_details):
     test_driver = TestHelper.TestDriver(testname)
 
     test_driver.pre_test_run(test_suite_details)
+    VistA1 = None
     try:
         # Connect to VistA
         VistA1=test_driver.connect_VistA(test_suite_details)
@@ -774,20 +776,3 @@ def stopmon (test_suite_details):
         VistA1.write('h\r')
         test_driver.finally_handling(test_suite_details)
     test_driver.end_method_handling(test_suite_details)
-
-def timeStamped(fname, fmt='%Y-%m-%d-%H-%M-%S_{fname}'):
-    '''This method appends a date/time stamp to a filename'''
-    return datetime.datetime.now().strftime(fmt).format(fname=fname)
-
-def connect_VistA(testname, result_dir, namespace):
-    ''' This method is used to establish the connection to VistA via ConnectToMUMPS'''
-    logging.debug('Connect_VistA' + ', Namespace: ' + namespace)
-    from OSEHRAHelper import ConnectToMUMPS, PROMPT
-    VistA = ConnectToMUMPS(logfile=result_dir + '/' + timeStamped(testname + '.txt'), instance='', namespace=namespace)
-    if VistA.type == 'cache':
-        try:
-            VistA.ZN(namespace)
-        except IndexError, no_namechange:
-            pass
-    VistA.wait(PROMPT)
-    return VistA
\ No newline at end of file
diff --git a/Packages/Registration/Testing/RAS/REGMain01_suite.py b/Packages/Registration/Testing/RAS/REGMain01_suite.py
index 4f83c0f..6edb02c 100644
--- a/Packages/Registration/Testing/RAS/REGMain01_suite.py
+++ b/Packages/Registration/Testing/RAS/REGMain01_suite.py
@@ -320,6 +320,7 @@ def startmon(test_suite_details):
     test_driver = TestHelper.TestDriver(testname)
 
     test_driver.pre_test_run(test_suite_details)
+    VistA1 = None
     try:
         VistA1 = test_driver.connect_VistA(test_suite_details)
         VistA1.startCoverage(routines=['DGPMV', 'DGSWITCH', 'DGSCHAD', 'DGPMEX', 'DGWAIT', 'DGSILL'])
@@ -344,6 +345,7 @@ def stopmon(test_suite_details):
     test_driver = TestHelper.TestDriver(testname)
 
     test_driver.pre_test_run(test_suite_details)
+    VistA1 = None
     try:
         VistA1 = test_driver.connect_VistA(test_suite_details)
         path = (test_suite_details.result_dir + '/' + TestHelper.timeStamped('ADT_coverage.txt'))
@@ -363,20 +365,3 @@ def stopmon(test_suite_details):
         test_driver.finally_handling(test_suite_details)
     test_driver.end_method_handling(test_suite_details)
 
-def timeStamped(fname, fmt='%Y-%m-%d-%H-%M-%S_{fname}'):
-    '''This method appends a date/time stamp to a filename'''
-    return datetime.datetime.now().strftime(fmt).format(fname=fname)
-
-def connect_VistA(testname, result_dir, namespace):
-    ''' This method is used to establish the connection to VistA via ConnectToMUMPS'''
-    logging.debug('Connect_VistA' + ', Namespace: ' + namespace)
-    from OSEHRAHelper import ConnectToMUMPS, PROMPT
-    VistA = ConnectToMUMPS(logfile=result_dir + '/' + timeStamped(testname + '.txt'), instance='', namespace=namespace)
-    if VistA.type == 'cache':
-        try:
-            VistA.ZN(namespace)
-        except IndexError, no_namechange:
-            pass
-    VistA.wait(PROMPT)
-    return VistA
-
diff --git a/Packages/Scheduling/Testing/RAS/SCMain01_suite.py b/Packages/Scheduling/Testing/RAS/SCMain01_suite.py
index 48346ab..9c33927 100644
--- a/Packages/Scheduling/Testing/RAS/SCMain01_suite.py
+++ b/Packages/Scheduling/Testing/RAS/SCMain01_suite.py
@@ -562,6 +562,7 @@ def startmon(test_suite_details):
     test_driver = TestHelper.TestDriver(testname)
 
     test_driver.pre_test_run(test_suite_details)
+    VistA1 = None
     try:
         VistA = test_driver.connect_VistA(test_suite_details)
         VistA.startCoverage(routines=['SC*', 'SD*'])
@@ -588,6 +589,7 @@ def stopmon (test_suite_details):
     test_driver = TestHelper.TestDriver(testname)
 
     test_driver.pre_test_run(test_suite_details)
+    VistA1 = None
     try:
         # Connect to VistA
         VistA=test_driver.connect_VistA(test_suite_details)
@@ -607,24 +609,3 @@ def stopmon (test_suite_details):
         VistA.write('h\r')
         test_driver.finally_handling(test_suite_details)
     test_driver.end_method_handling(test_suite_details)
-
-def timeStamped(fname, fmt='%Y-%m-%d-%H-%M-%S_{fname}'):
-    '''
-    This method appends a date/time stamp to a filename
-    '''
-    return datetime.datetime.now().strftime(fmt).format(fname=fname)
-
-def connect_VistA(testname, result_dir, namespace):
-    '''
-    This method is used to establish the connection to VistA via ConnectToMUMPS
-    '''
-    logging.debug('Connect_VistA' + ', Namespace: ' + namespace)
-    from OSEHRAHelper import ConnectToMUMPS, PROMPT
-    VistA = ConnectToMUMPS(logfile=result_dir + '/' + timeStamped(testname + '.txt'), instance='', namespace=namespace)
-    if VistA.type == 'cache':
-        try:
-            VistA.ZN(namespace)
-        except IndexError, no_namechange:
-            pass
-    VistA.wait(PROMPT)
-    return VistA
diff --git a/Python/vista/OSEHRAHelper.py b/Python/vista/OSEHRAHelper.py
index 094209b..1dc32a5 100644
--- a/Python/vista/OSEHRAHelper.py
+++ b/Python/vista/OSEHRAHelper.py
@@ -128,7 +128,7 @@ class ConnectMUMPS(object):
     self.wait('DEVICE')
     if sys.platform == 'win32':
       self.write('\r')
-      match = self.wait_re('\r\n[0-9]+', None)
+      match = self.wait_re('\r\n[0-9]+')
       test = match[1].span()
       number = ''
       for i in range(test[0], test[1]):
@@ -137,7 +137,7 @@ class ConnectMUMPS(object):
       self.IENumber = number
     else:
       self.write('')
-      self.wait_re('\n[0-9]+', None)
+      self.wait_re('\n[0-9]+')
       number = self.connection.after
       number = number.lstrip('\r\n')
       self.IENumber = number
@@ -166,6 +166,7 @@ class ConnectWinCache(ConnectMUMPS):
   def write(self, command):
     self.connection.write(command + '\r')
     logging.debug('connection.write:' + command)
+    self.log.flush()
 
   def wait(self, command, tout=15):
     logging.debug('connection.expect: ' + str(command))
@@ -187,7 +188,7 @@ class ConnectWinCache(ConnectMUMPS):
     if command is PROMPT:
       command = self.prompt
     compCommand = re.compile(command,re.I)
-    output = self.connection.expect([compCommand], None)
+    output = self.connection.expect([compCommand], timeout)
     self.match = output[1]
     self.before = output[2]
     if output[0] == -1 and output[1] == None:
@@ -590,12 +591,15 @@ def ConnectToMUMPS(logfile, instance='CACHE', namespace='VISTA', location='127.0
     elif sys.platform == 'linux2':
       if no_pexpect:
         raise no_pexpect
-      try:
-        return ConnectLinuxCache(logfile, instance, namespace, location)
-      except pexpect.ExceptionPexpect, no_cache:
-        pass
-      try:
-        return ConnectLinuxGTM(logfile, instance, namespace, location)
-      except pexpect.ExceptionPexpect, no_gtm:
-         if (no_cache and no_gtm):
+      if os.getenv('gtm_dist'):
+        try:
+          return ConnectLinuxGTM(logfile, instance, namespace, location)
+        except pexpect.ExceptionPexpect, no_gtm:
+           if (no_gtm):
+             raise "Cannot find a MUMPS instance"
+      else:
+        try:
+          return ConnectLinuxCache(logfile, instance, namespace, location)
+        except pexpect.ExceptionPexpect, no_cache:
+         if (no_cache):
            raise "Cannot find a MUMPS instance"
diff --git a/Python/vista/TestHelper.py b/Python/vista/TestHelper.py
index 4575743..fcce989 100644
--- a/Python/vista/TestHelper.py
+++ b/Python/vista/TestHelper.py
@@ -146,14 +146,9 @@ class TestSuiteDriver(object):
                 default_namespace)
         else:
             remote_conn_details = None
-            ''' #no longer using parms to set instance/namespace
-            if args.instance == 'TRYCACHE':
-                instance = 'cache'
-            else:
-                instance = args.instance
-            '''
-            instance = 'notused'
-            namespace = args.namespace
+            instance = os.getenv('CACHE_INSTANCE','notused')
+            namespace = os.getenv('CACHE_NAMESPACE','')
+            logging.info("Instance = %s, Namespace = %s" % (instance, namespace))
 
         if not os.path.isdir(args.resultdir):
             try:
diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt
index 9a2bbd3..dc03d2b 100644
--- a/Testing/CMakeLists.txt
+++ b/Testing/CMakeLists.txt
@@ -96,9 +96,7 @@ file(MAKE_DIRECTORY "${UNITTEST_LOG_DIR}")
 
 if(GTM_DIST)
   include(UseGTM)
-endif()
-
-if(CCONTROL_EXECUTABLE)
+elseif(CCONTROL_EXECUTABLE)
   include(UseCache)
 endif()
 
@@ -168,9 +166,9 @@ if(${CMAKE_VERSION} VERSION_GREATER 2.8.8)
 
     file(MAKE_DIRECTORY "${TEST_VISTA_OUTPUT_DIR}/Coverage")
 
-    if(NOT TEST_VISTA_COVERAGE_READABLE AND CCONTROL_EXECUTABLE)
+    if(NOT TEST_VISTA_COVERAGE_READABLE AND "${VENDOR_NAME}" STREQUAL "Cache")
       file(WRITE ${VISTA_BINARY_DIR}/cache_coverage.cmcov "packages:${TEST_VISTA_FRESH_M_DIR}/Packages\r\ncoverage_dir:${TEST_VISTA_OUTPUT_DIR}/Coverage")
-    elseif(NOT TEST_VISTA_COVERAGE_READABLE AND GTM_DIST)
+    elseif(NOT TEST_VISTA_COVERAGE_READABLE AND "${VENDOR_NAME}" STREQUAL "GTM")
       file(WRITE ${VISTA_BINARY_DIR}/gtm_coverage.mcov "packages:${TEST_VISTA_FRESH_M_DIR}/Packages\r\ncoverage_dir:${TEST_VISTA_OUTPUT_DIR}/Coverage")
     endif()
   endif()
diff --git a/Testing/Functional/CMakeLists.txt b/Testing/Functional/CMakeLists.txt
index f7991ef..aa5cd6a 100644
--- a/Testing/Functional/CMakeLists.txt
+++ b/Testing/Functional/CMakeLists.txt
@@ -61,13 +61,12 @@ if(TEST_VISTA_FUNCTIONAL_RAS)
       endforeach()
       file(GLOB RASUnitTests ${package}/Testing/RAS/UT*.py)
       set(vendor_args "")
-      if(CCONTROL_EXECUTABLE)
+      if("${VENDOR_NAME}" STREQUAL "Cache")
           list(APPEND vendor_args -S 1 -CN "${VISTA_CACHE_NAMESPACE}" -CI "${VISTA_CACHE_INSTANCE}")
           if(VISTA_CACHE_USERNAME)
               list(APPEND vendor_args -CU "${VISTA_CACHE_USERNAME}" -CP "${VISTA_CACHE_PASSWORD}")
           endif()
-      endif()
-      if(GTM_DIST)
+      elseif("${VENDOR_NAME}" STREQUAL "GTM")
           list(APPEND vendor_args -S 2)
       endif()
       foreach(RASUnitTest ${RASUnitTests})
diff --git a/Testing/Functional/RAS/RASTest.cmake.in b/Testing/Functional/RAS/RASTest.cmake.in
index 413e1d2..84de05c 100644
--- a/Testing/Functional/RAS/RASTest.cmake.in
+++ b/Testing/Functional/RAS/RASTest.cmake.in
@@ -1,4 +1,8 @@
+set(ENV{CACHE_INSTANCE} @VISTA_CACHE_INSTANCE@)
+set(ENV{CACHE_NAMESPACE} @VISTA_CACHE_NAMESPACE@)
 execute_process(COMMAND "@PYTHON_EXECUTABLE@" "@rastest@" "@TEST_VISTA_OUTPUT_DIR@" -n "@VISTA_CACHE_NAMESPACE@" -c "@TEST_VISTA_COVERAGE_READABLE@" -l @LOG_LEVEL@ WORKING_DIRECTORY "@VISTA_SOURCE_DIR@/Testing" ERROR_VARIABLE FunctionalError)
+set(ENV{CACHE_INSTANCE} "")
+set(ENV{CACHE_NAMESPACE} "")
 if(FunctionalError)
   message(FATAL_ERROR "${FunctionalError}")
-endif()
\ No newline at end of file
+endif()
diff --git a/Testing/OTJ/OTJTestDriver.cmake.in b/Testing/OTJ/OTJTestDriver.cmake.in
index b96211b..5492b3d 100644
--- a/Testing/OTJ/OTJTestDriver.cmake.in
+++ b/Testing/OTJ/OTJTestDriver.cmake.in
@@ -16,14 +16,14 @@
 
 # prepare the arguments list
 set(vendor_args "")
-if(EXISTS "@CCONTROL_EXECUTABLE@")
+if("@VENDOR_NAME@" STREQUAL "Cache")
   list(APPEND vendor_args -S 1 -CN "@VISTA_CACHE_NAMESPACE@" -CI "@VISTA_CACHE_INSTANCE@")
   string(STRIP "@VISTA_CACHE_USERNAME@" cacheusr)
   string(LENGTH "${cacheusr}" userLen)
   if(userLen)
     list(APPEND vendor_args -CU "@VISTA_CACHE_USERNAME@" -CP "@VISTA_CACHE_PASSWORD@")
   endif()
-elseif(EXISTS "@GTM_DIST@")
+elseif("@VENROD_NAME@" STREQUAL "GTM")
   list(APPEND vendor_args -S 2)
 endif()
 set(OTJ_PATCH_DIR "@OTJ_SUBMISSION_DIR@")
diff --git a/Testing/Setup/ImportRG.cmake.in b/Testing/Setup/ImportRG.cmake.in
index f295880..2c801e9 100644
--- a/Testing/Setup/ImportRG.cmake.in
+++ b/Testing/Setup/ImportRG.cmake.in
@@ -43,14 +43,14 @@ if(TEST_VISTA_FRESH_CUSTOM_REFRESH)
   execute_process(COMMAND @TEST_VISTA_FRESH_CUSTOM_COMMAND@ RESULT_VARIABLE return)
   CheckResult(return "Custom refreshed Failed")
 else()
-  if(EXISTS "@CCONTROL_EXECUTABLE@")
+  if("@VENDOR_NAME@" STREQUAL "Cache")
     message(STATUS "Stopping cache instance @VISTA_CACHE_INSTANCE@")
     execute_process( COMMAND "@CCONTROL_EXECUTABLE@" stop @VISTA_CACHE_INSTANCE@ quietly)
     message(STATUS "Replacing @TEST_VISTA_FRESH_CACHE_DAT_VISTA@")
     file(COPY @TEST_VISTA_FRESH_CACHE_DAT_EMPTY@ DESTINATION @TEST_VISTA_FRESH_CACHE_DIR_VISTA@)
     message(STATUS "Starting cache instance @VISTA_CACHE_INSTANCE@")
     execute_process(COMMAND "@CCONTROL_EXECUTABLE@" start @VISTA_CACHE_INSTANCE@)
-  else()
+  elseif("@VENDOR_NAME@" STREQUAL "GTM")
     message(STATUS "Stop all running mumps process")
     stop_mumps_process()
     message(STATUS "Removing GT.M database located @TEST_VISTA_FRESH_GTM_GLOBALS_DAT@")
@@ -64,6 +64,8 @@ else()
     CheckResult(return "mupip create Failed")
     execute_process(COMMAND "@GTM_DIST@/dse" change -f -key_max=1023 -rec=4096 WORKING_DIRECTORY ${TEST_VISTA_FRESH_GTM_GLOBALS_DIR}/  RESULT_VARIABLE return )
     CheckResult(return "Database Configuration Failed")
+  else()
+    message(FATAL_ERROR "Unknown Mumps Vendor: @VENDOR_NAME@")
   endif()
 endif()
 message(STATUS "Preparing M Components...")
@@ -74,7 +76,7 @@ message(STATUS "Importing VistA Routines...")
 execute_process(COMMAND "@PYTHON_EXECUTABLE@" "@CMAKE_CURRENT_BINARY_DIR@/VistARoutineImport.py" RESULT_VARIABLE return)
 CheckResult(return "VistA Routine Import Failed")
 
-if(TEST_VISTA_SETUP AND NOT EXISTS "@CCONTROL_EXECUTABLE@")
+if((TEST_VISTA_SETUP) AND ("@VENDOR_NAME@" STREQUAL "GTM"))
   file(GLOB ImportRoutines "@CMAKE_CURRENT_SOURCE_DIR@/*.ro")
   foreach(RoutineImportFile ${ImportRoutines})
     get_filename_component(routineName "${RoutineImportFile}" NAME_WE)
@@ -85,7 +87,7 @@ if(TEST_VISTA_SETUP AND NOT EXISTS "@CCONTROL_EXECUTABLE@")
 endif()
 
 message(STATUS "Importing globals...")
-if(TEST_VISTA_SETUP AND NOT EXISTS "@CCONTROL_EXECUTABLE@")
+if((TEST_VISTA_SETUP) AND ("@VENDOR_NAME@" STREQUAL "GTM"))
   file(STRINGS "@VISTA_BINARY_DIR@/globals.lst" allGlobalFiles)
   set(importLogFile "@VISTA_BINARY_DIR@/Testing/Log/GlobalImport0.log")
   file(REMOVE ${importLogFile})
@@ -98,7 +100,7 @@ if(TEST_VISTA_SETUP AND NOT EXISTS "@CCONTROL_EXECUTABLE@")
 endif()
 execute_process(COMMAND "@PYTHON_EXECUTABLE@" "@CMAKE_CURRENT_BINARY_DIR@/GlobalImport.py" RESULT_VARIABLE return )
 CheckResult(return "Global Import Failed")
-if(EXISTS "@CCONTROL_EXECUTABLE@")
+if("@VENDOR_NAME@" STREQUAL "Cache")
   message(STATUS "Initializing VistA...")
   execute_process(COMMAND "@PYTHON_EXECUTABLE@" "@CMAKE_CURRENT_BINARY_DIR@/Initialize.py" )
 endif()
diff --git a/Testing/UnitTest.cmake.in b/Testing/UnitTest.cmake.in
index 7c7e8b3..6178191 100644
--- a/Testing/UnitTest.cmake.in
+++ b/Testing/UnitTest.cmake.in
@@ -16,14 +16,14 @@
 include("@VISTA_SOURCE_DIR@/CMake/CommonFunctions.cmake")
 message(STATUS "Checking MUnit Patches...")
 set(vendor_args "")
-if(EXISTS "@CCONTROL_EXECUTABLE@")
+if("@VENDOR_NAME@" STREQUAL "Cache")
   list(APPEND vendor_args -S 1 -CN "@VISTA_CACHE_NAMESPACE@" -CI "@VISTA_CACHE_INSTANCE@")
   string(STRIP "@VISTA_CACHE_USERNAME@" cacheusr)
   string(LENGTH "${cacheusr}" userLen)
   if(userLen)
     list(APPEND vendor_args -CU "@VISTA_CACHE_USERNAME@" -CP "@VISTA_CACHE_PASSWORD@")
   endif()
-elseif(EXISTS "@GTM_DIST@")
+elseif("@VENDOR_NAME@" STREQUAL "GTM")
   list(APPEND vendor_args -S 2)
 endif()
 set(MUNIT_PATCH_DIR "@VISTA_SOURCE_DIR@/Testing/Setup/Patches/MUnit")

-- 
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/vista.git



More information about the debian-med-commit mailing list