Skip to content

Commit

Permalink
Consistency check to ensure that PDO_DEBUG_BUILD is enabled in SIM mo…
Browse files Browse the repository at this point in the history
…de and disabled in HW-Release mode

Signed-off-by: Bruno Vavala <[email protected]>
  • Loading branch information
bvavala committed May 16, 2024
1 parent 2220ada commit 35a5aa9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
if: "!contains(github.event.commits[0].message, '[debug]')"
env:
PDO_INTERPRETER: ${{ matrix.interpreter }}
PDO_DEBUG_BUILD: 1
PDO_LOG_LEVEL: warning
run: |
# The creation of a dummy branch is necessary for the CI tests
# to work on PRs. Based on empirical results, in the absence of
Expand Down
2 changes: 2 additions & 0 deletions build/__tools__/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ fi
# Build type "Debug" does not define NDEBUG, which causes sgx_urts.h to set SGX_DEBUG_FLAG to 1.
if [ ${PDO_DEBUG_BUILD} == "0" ]; then
MAKE_ARGS+=" CMAKE_OPTS=-DCMAKE_BUILD_TYPE=Release"
CMAKE_ARGS+=" -DCMAKE_BUILD_TYPE=Release"
else
MAKE_ARGS+=" CMAKE_OPTS=-DCMAKE_BUILD_TYPE=Debug"
CMAKE_ARGS+=" -DCMAKE_BUILD_TYPE=Debug"
fi

# -----------------------------------------------------------------
Expand Down
10 changes: 10 additions & 0 deletions build/cmake/SGX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,18 @@ SET(SGX_MODE $ENV{SGX_MODE})

IF (${SGX_MODE} STREQUAL "SIM")
SET(SGX_USE_SIMULATOR TRUE)

IF (${PDO_DEBUG_BUILD} STREQUAL "0")
MESSAGE(FATAL_ERROR "SGX_MODE=SIM does not accept PDO_DEBUG_BUILD=0")
ENDIF()
ELSE()
SET(SGX_USE_SIMULATOR FALSE)

IF (${CMAKE_BUILD_TYPE} STREQUAL "Release")
IF (${PDO_DEBUG_BUILD} STREQUAL "1")
MESSAGE(FATAL_ERROR "SGX_MODE=HW and CMAKE_BUILD_TYPE=Release do not accept PDO_DEBUG_BUILD=1")
ENDIF()
ENDIF()
ENDIF()

IF (NOT DEFINED ENV{SGX_SDK})
Expand Down
4 changes: 3 additions & 1 deletion docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ PDO_SOURCE_ROOT ?= $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../

# PDO_DEBUG_BUILD
# The flag that determines the build type (debug or not).
PDO_DEBUG_BUILD ?= 0
PDO_DEBUG_BUILD ?= ${PDO_DEBUG_BUILD:-0}

# PDO_REPO --
# The URL or path to the git repository, the default uses the current repository
Expand Down Expand Up @@ -73,12 +73,14 @@ rebuild_% : repository
$(DOCKER_COMMAND) build $(DOCKER_ARGS) \
--build-arg REBUILD=$(TIMESTAMP) \
--build-arg PDO_VERSION=$(PDO_VERSION) \
--build-arg PDO_DEBUG_BUILD=$(PDO_DEBUG_BUILD) \
--tag pdo_$*:$(PDO_VERSION) \
--file '$(DOCKER_DIR)'/pdo_$*.dockerfile .

build_% : repository
$(DOCKER_COMMAND) build $(DOCKER_ARGS) \
--build-arg PDO_VERSION=$(PDO_VERSION) \
--build-arg PDO_DEBUG_BUILD=$(PDO_DEBUG_BUILD) \
--tag pdo_$*:$(PDO_VERSION) \
--file '$(DOCKER_DIR)'/pdo_$*.dockerfile .

Expand Down

0 comments on commit 35a5aa9

Please sign in to comment.