diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8191032d..636006ea 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,6 +20,7 @@ jobs: uses: actions/checkout@v2 - name: Build and run tests + if: "!contains(github.event.commits[0].message, '[debug]')" env: PDO_INTERPRETER: ${{ matrix.interpreter }} run: | @@ -30,3 +31,18 @@ jobs: git checkout -b ci-test-branch . build/common-config.sh make -C docker test + + - name: Build and run tests (DEBUG MODE) + if: "contains(github.event.commits[0].message, '[debug]')" + env: + PDO_INTERPRETER: ${{ matrix.interpreter }} + PDO_DEBUG_BUILD: 1 + PDO_LOG_LEVEL: debug + 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 + # this command, CI tests work on the main branch and on local + # branches. However, they fail as a PR is created. + git checkout -b ci-test-branch + . build/common-config.sh + make -C docker test diff --git a/build/tests/unit-test.sh b/build/tests/unit-test.sh index 0a1fca1f..bcdd2ab4 100755 --- a/build/tests/unit-test.sh +++ b/build/tests/unit-test.sh @@ -21,24 +21,32 @@ check_python_version PDO_LOG_LEVEL=${PDO_LOG_LEVEL:-info} +OUTFILE='/dev/null' +CMAKE_TEST_ARGS='' + +if [ "${PDO_LOG_LEVEL,,}" == 'debug' ]; then + CMAKE_TEST_ARGS='ARGS=-V' + OUTFILE='/dev/stdout' +fi + # ----------------------------------------------------------------- yell run unit tests for python, common, contracts and eservice # ----------------------------------------------------------------- -say run unit tests for python package -cd ${PDO_SOURCE_ROOT}/python -try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > /dev/null - say run unit tests for common library cd ${PDO_SOURCE_ROOT}/common/build -try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > /dev/null +try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} ${CMAKE_TEST_ARGS} test > ${OUTFILE} + +say run unit tests for python package +cd ${PDO_SOURCE_ROOT}/python +try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > ${OUTFILE} say run unit tests for eservice cd ${PDO_SOURCE_ROOT}/eservice -try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > /dev/null +try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > ${OUTFILE} say run unit tests for contracts cd ${PDO_SOURCE_ROOT}/contracts -try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > /dev/null +try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > ${OUTFILE} # ----------------------------------------------------------------- yell start tests without provisioning or enclave services diff --git a/docker/client_base.yaml b/docker/client_base.yaml index 9dbd3836..0929529b 100644 --- a/docker/client_base.yaml +++ b/docker/client_base.yaml @@ -27,6 +27,8 @@ services: PDO_LEDGER_TYPE: ccf PDO_HOSTNAME: ${PDO_HOSTNAME} PDO_LEDGER_URL: ${PDO_LEDGER_URL} + PDO_LOG_LEVEL: ${PDO_LOG_LEVEL:-info} + PDO_DEBUG_BUILD: ${PDO_DEBUG_BUILD:-0} depends_on: - ccf_container - services_container diff --git a/docker/pdo_client.dockerfile b/docker/pdo_client.dockerfile index 84c1f75d..0a47a00b 100644 --- a/docker/pdo_client.dockerfile +++ b/docker/pdo_client.dockerfile @@ -48,6 +48,9 @@ ENV PDO_INTERPRETER=${PDO_INTERPRETER} ARG WASM_MEM_CONFIG=MEDIUM ENV WASM_MEM_CONFIG=${WASM_MEM_CONFIG} +ARG PDO_LOG_LEVEL=info +ENV PDO_LOG_LEVEL=${PDO_LOG_LEVEL} + # copy the source files into the image WORKDIR /project/pdo COPY --chown=${UNAME}:${UNAME} repository /project/pdo/src diff --git a/docker/pdo_services.dockerfile b/docker/pdo_services.dockerfile index d6413066..a3deab47 100644 --- a/docker/pdo_services.dockerfile +++ b/docker/pdo_services.dockerfile @@ -33,6 +33,9 @@ ENV PDO_INTERPRETER=${PDO_INTERPRETER} ARG WASM_MEM_CONFIG=MEDIUM ENV WASM_MEM_CONFIG=${WASM_MEM_CONFIG} +ARG PDO_LOG_LEVEL=info +ENV PDO_LOG_LEVEL=${PDO_LOG_LEVEL} + # copy the source files into the image WORKDIR /project/pdo COPY --chown=${UNAME}:${UNAME} repository /project/pdo/src diff --git a/docker/pdo_services_base.dockerfile b/docker/pdo_services_base.dockerfile index 073aab03..111e6305 100644 --- a/docker/pdo_services_base.dockerfile +++ b/docker/pdo_services_base.dockerfile @@ -19,11 +19,11 @@ FROM pdo_base ARG UBUNTU_VERSION=20.04 ARG UBUNTU_NAME=focal -ARG SGX=2.21 -ARG OPENSSL=3.0.10 -ARG SGXSSL=3.0-rc2 +ARG SGX=2.22 +ARG OPENSSL=3.0.12 +ARG SGXSSL=3.0_Rev1 -ARG SGX_MODE SIM +ARG SGX_MODE=SIM ENV SGX_MODE $SGX_MODE RUN echo "deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu ${UBUNTU_NAME} main" >> /etc/apt/sources.list \ @@ -80,7 +80,8 @@ RUN . /opt/intel/sgxsdk/environment \ && git clone --depth 1 --branch ${SGXSSL} 'https://github.com/intel/intel-sgx-ssl.git' \ && wget -q -P /tmp/intel-sgx-ssl/openssl_source https://www.openssl.org/source/openssl-${OPENSSL}.tar.gz \ && cd /tmp/intel-sgx-ssl/Linux \ - && bash -c "make SGX_MODE=SIM NO_THREADS=1 DESTDIR=/opt/intel/sgxssl VERBOSE=0 all &> /dev/null" \ + && if [ $SGX_MODE = SIM ] ; then SKIP_INTELCPU_CHECK=TRUE ; else SKIP_INTELCPU_CHECK=FALSE ; fi \ + && bash -c "make SKIP_INTELCPU_CHECK=$SKIP_INTELCPU_CHECK SGX_MODE=$SGX_MODE NO_THREADS=1 DESTDIR=/opt/intel/sgxssl VERBOSE=0 all &> /dev/null" \ && make install \ && make clean \ && rm -rf /tmp/intel-sgx-ssl diff --git a/docker/services_base.yaml b/docker/services_base.yaml index 3287781b..72c619e2 100644 --- a/docker/services_base.yaml +++ b/docker/services_base.yaml @@ -27,6 +27,8 @@ services: PDO_LEDGER_TYPE: ccf PDO_LEDGER_URL: ${PDO_LEDGER_URL} SGX_MODE: ${SGX_MODE:-SIM} + PDO_LOG_LEVEL: ${PDO_LOG_LEVEL:-info} + PDO_DEBUG_BUILD: ${PDO_DEBUG_BUILD:-0} container_name: services_container network_mode: "host" depends_on: diff --git a/docker/test.yaml b/docker/test.yaml index e36e7fb4..cbb71d0a 100644 --- a/docker/test.yaml +++ b/docker/test.yaml @@ -27,6 +27,8 @@ services: args: PDO_HOSTNAME: localhost PDO_LEDGER_URL: http://localhost:6600 + PDO_LOG_LEVEL: ${PDO_LOG_LEVEL:-info} + PDO_DEBUG_BUILD: ${PDO_DEBUG_BUILD:-0} entrypoint: /project/pdo/tools/run_services_tests.sh client_container: @@ -34,4 +36,6 @@ services: args: PDO_HOSTNAME: localhost PDO_LEDGER_URL: http://localhost:6600 + PDO_LOG_LEVEL: ${PDO_LOG_LEVEL:-info} + PDO_DEBUG_BUILD: ${PDO_DEBUG_BUILD:-0} entrypoint: /project/pdo/tools/run_client_tests.sh