-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add build/test script for getdcmtags
update getdcmtag binaries
- Loading branch information
Roy Wiggins
authored and
Roy Wiggins
committed
Nov 22, 2024
1 parent
7dd42e7
commit 71e5255
Showing
7 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ARG UBUNTU_VERSION=22.04 | ||
FROM ubuntu:${UBUNTU_VERSION} | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
# Install necessary packages | ||
RUN apt-get update && apt-get install -y \ | ||
build-essential \ | ||
qtbase5-dev \ | ||
dcmtk \ | ||
libdcmtk-dev \ | ||
jq \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Copy the project files into the container | ||
COPY . . | ||
RUN mkdir /build | ||
|
||
# Set the default command | ||
CMD qmake && make && ./test.sh && cp getdcmtags /build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
build_docker_image() { | ||
local UBUNTU_VERSION=$1 | ||
|
||
echo "Building Docker image for Ubuntu $UBUNTU_VERSION" | ||
|
||
# Build the Docker image | ||
docker build --build-arg UBUNTU_VERSION=$UBUNTU_VERSION -t mercure-getdcmtags-build:$UBUNTU_VERSION . | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Docker build failed for Ubuntu $UBUNTU_VERSION" | ||
return 1 | ||
fi | ||
|
||
echo "Docker image for Ubuntu $UBUNTU_VERSION built successfully" | ||
echo "----------------------------------------" | ||
} | ||
|
||
|
||
build_qt_project() { | ||
local UBUNTU_VERSION=$1 | ||
|
||
echo "Building for Ubuntu $UBUNTU_VERSION" | ||
|
||
docker run -it mercure-getdcmtags-build:$UBUNTU_VERSION | ||
local last_container=$(docker ps -lq) | ||
docker cp $last_container:/build/getdcmtags ../bin/ubuntu${UBUNTU_VERSION}/getdcmtags | ||
docker rm $last_container | ||
|
||
echo "Build for Ubuntu $UBUNTU_VERSION completed" | ||
echo "----------------------------------------" | ||
} | ||
|
||
# Main execution | ||
echo "Starting getdcmtags build" | ||
echo "=======================================================" | ||
|
||
# Build for each Ubuntu version | ||
for VERSION in 20.04 22.04 24.04; do | ||
build_docker_image $VERSION | ||
done | ||
|
||
# Run builds and extract executables for each Ubuntu version | ||
for VERSION in 20.04 22.04 24.04; do | ||
build_qt_project $VERSION | ||
done | ||
|
||
|
||
|
||
echo "All builds completed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
echo "Testing" | ||
cp test_dcm test_dcm_copy | ||
./getdcmtags test_dcm_copy sender_address sender_aet receiver_aet 0.0.0.0 asdf --set-tag forceKey=forcedValue | ||
uid="1.2.276.0.7230010.3.1.3.9022104837472469675953272569912339663578" | ||
if [ ! -e $uid/$uid#test_dcm_copy.tags ]; then | ||
echo "Failed to create tags file" | ||
exit 1 | ||
fi | ||
|
||
|
||
check_key() { | ||
local key="$1" | ||
local expected_value="$2" | ||
local actual_value=$(jq -r ".$key // \"__NULL__\"" "$uid/$uid#test_dcm_copy.tags") | ||
|
||
if [ "$actual_value" == "__NULL__" ]; then | ||
cat $uid/$uid#test_dcm_copy.tags | ||
echo "Key '$key' not found in the JSON file." | ||
echo "Test failed" | ||
exit 1 | ||
elif [ "$actual_value" == "$expected_value" ]; then | ||
return | ||
# echo "Key '$key' matches expected value: $actual_value" | ||
else | ||
cat $uid/$uid#test_dcm_copy.tags | ||
echo "Key '$key' does not match. Expected: $expected_value, Actual: $actual_value" | ||
echo "Test failed" | ||
exit 1 | ||
fi | ||
} | ||
|
||
|
||
check_key "Filename" "test_dcm_copy" | ||
check_key "SenderAddress" "sender_address" | ||
check_key "SenderAET" "sender_aet" | ||
check_key "ReceiverAET" "receiver_aet" | ||
check_key "SeriesInstanceUID" "$uid" | ||
check_key "forceKey" "forcedValue" | ||
|
||
rm -f test_dcm_copy | ||
rm -rf $uid | ||
|
||
echo "Success" |
Binary file not shown.