changeset 306:da2be3ff2db5 c-get

fix getscu binaries
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 May 2020 08:41:21 +0200
parents b55b959647ed
children 5be63aef39b1
files Start.sh Tests/Run.py Tests/Tests.py
diffstat 3 files changed, 41 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/Start.sh	Tue May 12 14:36:29 2020 +0200
+++ b/Start.sh	Wed May 20 08:41:21 2020 +0200
@@ -3,4 +3,18 @@
 # Without Docker:
 # python ./Tests/Run.py --force
 
-sudo docker run --rm -t -i -v `pwd`:/tmp/tests:ro -p 5000:5000 -p 5001:5001 --entrypoint python jodogne/orthanc-tests /tmp/tests/Tests/Run.py --docker $*
+set -ex
+
+if [ ! -f "./getscu-3.6.5" ]; then
+    # This binary was generated by running Linux Standard Base on
+    # "Resources/DcmtkTools" in the Orthanc source distribution,
+    # as DCMTK 3.6.0 does not contain "getscu"
+    wget http://orthanc.osimis.io/ThirdPartyDownloads/linux-standard-base/getscu-3.6.5
+    chmod +x ./getscu-3.6.5
+fi
+
+sudo docker run --rm -t -i -p 5000:5000 -p 5001:5001 \
+     -v `pwd`:/tmp/tests:ro \
+     -v `pwd`/getscu-3.6.5:/usr/bin/getscu:ro \
+     --entrypoint python jodogne/orthanc-tests \
+     /tmp/tests/Tests/Run.py --docker $*
--- a/Tests/Run.py	Tue May 12 14:36:29 2020 +0200
+++ b/Tests/Run.py	Wed May 20 08:41:21 2020 +0200
@@ -153,7 +153,7 @@
 
 try:
     print('\nStarting the tests...')
-    SetOrthancParameters(LOCAL, REMOTE)
+    SetOrthancParameters(LOCAL, REMOTE, args.docker)
 
     unittest.main(argv = [ sys.argv[0] ] + args.options)
 
--- a/Tests/Tests.py	Tue May 12 14:36:29 2020 +0200
+++ b/Tests/Tests.py	Wed May 20 08:41:21 2020 +0200
@@ -35,14 +35,16 @@
 
 _LOCAL = None
 _REMOTE = None
-
-
-def SetOrthancParameters(local, remote):
-    global _LOCAL, _REMOTE
+_DOCKER = False
+
+
+def SetOrthancParameters(local, remote, withinDocker):
+    global _LOCAL, _REMOTE, _DOCKER
     _LOCAL = local
     _REMOTE = remote
-
-
+    _DOCKER = withinDocker
+
+    
 def ExtractDicomTags(rawDicom, tags):
     with tempfile.NamedTemporaryFile(delete = True) as f:
         f.write(rawDicom)
@@ -5635,7 +5637,13 @@
         
 
     def test_getscu(self):
-        
+        env = {}
+        if _DOCKER:
+            # This is "getscu" from DCMTK 3.6.5 compiled using LSB,
+            # and running in a GNU/Linux distribution running DCMTK
+            # 3.6.0. Tell "getscu" where it can find the DICOM dictionary.
+            env['DCMDICTPATH'] = '/usr/share/libdcmtk2/dicom.dic'
+
         # no transcoding required
         UploadInstance(_REMOTE, 'DummyCT.dcm')
 
@@ -5643,15 +5651,16 @@
             shutil.rmtree('/tmp/GETSCU')
         os.makedirs('/tmp/GETSCU')
 
-        subprocess.check_call([ FindExecutable('getscu'),
-                                _REMOTE['Server'], 
-                                str(_REMOTE['DicomPort']),
-                                '-aec', 'ORTHANC',
-                                '-aet', 'ORTHANCTEST', # pretend to be the other orthanc
-                                '-k', '0020,000d=1.2.840.113619.2.176.2025.1499492.7391.1171285944.390',
-                                '-k', '0008,0052=STUDY',
-                                '--output-directory', '/tmp/GETSCU/' 
-                             ])
+        subprocess.check_call([
+            FindExecutable('getscu'),
+            _REMOTE['Server'], 
+            str(_REMOTE['DicomPort']),
+            '-aec', 'ORTHANC',
+            '-aet', 'ORTHANCTEST', # pretend to be the other orthanc
+            '-k', '0020,000d=1.2.840.113619.2.176.2025.1499492.7391.1171285944.390',
+            '-k', '0008,0052=STUDY',
+            '--output-directory', '/tmp/GETSCU/' 
+        ], env = env)
 
         self.assertTrue(os.path.isfile('/tmp/GETSCU/MR.1.2.840.113619.2.176.2025.1499492.7040.1171286242.109'))