From 3353670c65a1967cc7e22c9c698c469ff847ac9b Mon Sep 17 00:00:00 2001 From: Wenxing Hou Date: Thu, 14 Sep 2023 15:52:52 +0800 Subject: [PATCH] Make spdm_emu return_false_for_error for CI Fix the issue: #265 Make the spdm_emu return false for the error case. Then the CI check can be simplified. Signed-off-by: Wenxing Hou --- .github/workflows/build_CI.yml | 188 ++---------------- .github/workflows/build_CI_FIPS.yml | 184 ++--------------- .../workflows/build_CI_for_slot_id_0xFF.yml | 67 +------ .github/workflows/build_CI_for_version1.1.yml | 63 +----- .github/workflows/chunk_check.yml | 183 +---------------- .../spdm_requester_authentication.c | 2 +- .../spdm_requester_emu/spdm_requester_emu.c | 20 +- .../spdm_responder_emu/spdm_responder_emu.c | 13 +- 8 files changed, 69 insertions(+), 651 deletions(-) diff --git a/.github/workflows/build_CI.yml b/.github/workflows/build_CI.yml index 16dcdda..677cbbf 100644 --- a/.github/workflows/build_CI.yml +++ b/.github/workflows/build_CI.yml @@ -54,40 +54,16 @@ jobs: echo "port is used" fi ./spdm_responder_emu & + sleep 5s ./spdm_requester_emu >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu & - ./spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi + sleep 10s - minsize=1070000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - name: Responder_validator_Test run: | cd build/bin ./spdm_responder_emu & + sleep 5s ./spdm_device_validator_sample - name: Test_RECORD_TRANSCRIPT_DATA_consistent # open LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT flag @@ -105,71 +81,15 @@ jobs: cd bin echo "requester (DATA_SUPPORT = 0) <=> responder (DATA_SUPPORT = 1)" ./spdm_responder_emu & + sleep 5s ./../../build/bin/spdm_requester_emu >requester.log - filename=./../../build/bin/requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu & - ./../../build/bin/spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1070000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - sleep 10s echo "requester (DATA_SUPPORT = 1) <=> responder (DATA_SUPPORT = 0)" ./../../build/bin/spdm_responder_emu & + sleep 5s ./spdm_requester_emu >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./../../build/bin/spdm_responder_emu & - ./spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1070000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - gcc_openssl_build: runs-on: ubuntu-latest steps: @@ -198,40 +118,15 @@ jobs: echo "port is used" fi ./spdm_responder_emu & + sleep 5s ./spdm_requester_emu >requester.log + sleep 10s - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu & - ./spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1070000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - name: Responder_validator_Test run: | cd build/bin ./spdm_responder_emu & + sleep 5s ./spdm_device_validator_sample - name: Test_RECORD_TRANSCRIPT_DATA_consistent # open LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT flag @@ -249,70 +144,15 @@ jobs: cd bin echo "requester (DATA_SUPPORT = 0) <=> responder (DATA_SUPPORT = 1)" ./spdm_responder_emu & + sleep 5s ./../../build/bin/spdm_requester_emu >requester.log - filename=./../../build/bin/requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu & - ./../../build/bin/spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1070000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - sleep 10s echo "requester (DATA_SUPPORT = 1) <=> responder (DATA_SUPPORT = 0)" ./../../build/bin/spdm_responder_emu & + sleep 5s ./spdm_requester_emu >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./../../build/bin/spdm_responder_emu & - ./spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1070000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi VS2019_mbedtls_build: runs-on: windows-latest @@ -338,11 +178,14 @@ jobs: run: | cd build/bin ./spdm_responder_emu & + sleep 5s ./spdm_requester_emu + sleep 10s - name: Responder_validator_Test run: | cd build/bin ./spdm_responder_emu & + sleep 5s ./spdm_device_validator_sample VS2019_openssl_build: @@ -370,9 +213,12 @@ jobs: run: | cd build/bin ./spdm_responder_emu & + sleep 5s ./spdm_requester_emu + sleep 10s - name: Responder_validator_Test run: | cd build/bin ./spdm_responder_emu & - ./spdm_device_validator_sample \ No newline at end of file + sleep 5s + ./spdm_device_validator_sample diff --git a/.github/workflows/build_CI_FIPS.yml b/.github/workflows/build_CI_FIPS.yml index a4fb9f8..037c48d 100644 --- a/.github/workflows/build_CI_FIPS.yml +++ b/.github/workflows/build_CI_FIPS.yml @@ -54,40 +54,14 @@ jobs: echo "port is used" fi ./spdm_responder_emu & + sleep 5s ./spdm_requester_emu >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu & - ./spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1070000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - name: Responder_validator_Test run: | cd build/bin ./spdm_responder_emu & + sleep 5s ./spdm_device_validator_sample - name: Test_RECORD_TRANSCRIPT_DATA_consistent # open LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT flag @@ -105,71 +79,15 @@ jobs: cd bin echo "requester (DATA_SUPPORT = 0) <=> responder (DATA_SUPPORT = 1)" ./spdm_responder_emu & + sleep 5s ./../../build/bin/spdm_requester_emu >requester.log - filename=./../../build/bin/requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu & - ./../../build/bin/spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1070000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - sleep 10s echo "requester (DATA_SUPPORT = 1) <=> responder (DATA_SUPPORT = 0)" ./../../build/bin/spdm_responder_emu & + sleep 5s ./spdm_requester_emu >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./../../build/bin/spdm_responder_emu & - ./spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1070000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - gcc_openssl_build: runs-on: ubuntu-latest steps: @@ -198,40 +116,14 @@ jobs: echo "port is used" fi ./spdm_responder_emu & + sleep 5s ./spdm_requester_emu >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu & - ./spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1070000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - name: Responder_validator_Test run: | cd build/bin ./spdm_responder_emu & + sleep 5s ./spdm_device_validator_sample - name: Test_RECORD_TRANSCRIPT_DATA_consistent # open LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT flag @@ -249,71 +141,15 @@ jobs: cd bin echo "requester (DATA_SUPPORT = 0) <=> responder (DATA_SUPPORT = 1)" ./spdm_responder_emu & + sleep 5s ./../../build/bin/spdm_requester_emu >requester.log - filename=./../../build/bin/requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu & - ./../../build/bin/spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1070000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - sleep 10s echo "requester (DATA_SUPPORT = 1) <=> responder (DATA_SUPPORT = 0)" ./../../build/bin/spdm_responder_emu & + sleep 5s ./spdm_requester_emu >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./../../build/bin/spdm_responder_emu & - ./spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1070000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - VS2019_mbedtls_build: runs-on: windows-latest steps: @@ -338,11 +174,13 @@ jobs: run: | cd build/bin ./spdm_responder_emu & + sleep 5s ./spdm_requester_emu - name: Responder_validator_Test run: | cd build/bin ./spdm_responder_emu & + sleep 5s ./spdm_device_validator_sample VS2019_openssl_build: @@ -370,9 +208,11 @@ jobs: run: | cd build/bin ./spdm_responder_emu & + sleep 5s ./spdm_requester_emu - name: Responder_validator_Test run: | cd build/bin ./spdm_responder_emu & + sleep 5s ./spdm_device_validator_sample diff --git a/.github/workflows/build_CI_for_slot_id_0xFF.yml b/.github/workflows/build_CI_for_slot_id_0xFF.yml index bba0d83..ab50fe0 100644 --- a/.github/workflows/build_CI_for_slot_id_0xFF.yml +++ b/.github/workflows/build_CI_for_slot_id_0xFF.yml @@ -54,38 +54,9 @@ jobs: echo "port is used" fi ./spdm_responder_emu --cap CACHE,CHAL,MEAS_SIG,MEAS_FRESH,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK_WITH_CONTEXT,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID & + sleep 5s ./spdm_requester_emu --cap CHAL,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu --cap CACHE,CHAL,MEAS_SIG,MEAS_FRESH,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK_WITH_CONTEXT,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID & - ./spdm_requester_emu --cap CHAL,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=590000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - - gcc_openssl_build: runs-on: ubuntu-latest steps: @@ -114,37 +85,9 @@ jobs: echo "port is used" fi ./spdm_responder_emu --cap CACHE,CHAL,MEAS_SIG,MEAS_FRESH,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK_WITH_CONTEXT,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID & + sleep 5s ./spdm_requester_emu --cap CHAL,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu --cap CACHE,CHAL,MEAS_SIG,MEAS_FRESH,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK_WITH_CONTEXT,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID & - ./spdm_requester_emu --cap CHAL,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=590000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - VS2019_mbedtls_build: runs-on: windows-latest steps: @@ -168,7 +111,8 @@ jobs: - name: Emu_Test run: | cd build/bin - ./spdm_responder_emu --cap CACHE,CHAL,MEAS_SIG,MEAS_FRESH,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK_WITH_CONTEXT,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID & + ./spdm_responder_emu --cap CACHE,CHAL,MEAS_SIG,MEAS_FRESH,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK_WITH_CONTEXT,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID >responder.log & + sleep 10s ./spdm_requester_emu --cap CHAL,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID VS2019_openssl_build: @@ -195,5 +139,6 @@ jobs: - name: Emu_Test run: | cd build/bin - ./spdm_responder_emu --cap CACHE,CHAL,MEAS_SIG,MEAS_FRESH,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK_WITH_CONTEXT,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID & + ./spdm_responder_emu --cap CACHE,CHAL,MEAS_SIG,MEAS_FRESH,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK_WITH_CONTEXT,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID >responder.log & + sleep 10s ./spdm_requester_emu --cap CHAL,ENCRYPT,MAC,MUT_AUTH,KEY_EX,PSK,ENCAP,HBEAT,KEY_UPD,HANDSHAKE_IN_CLEAR,PUB_KEY_ID diff --git a/.github/workflows/build_CI_for_version1.1.yml b/.github/workflows/build_CI_for_version1.1.yml index f0f3650..4671d1f 100644 --- a/.github/workflows/build_CI_for_version1.1.yml +++ b/.github/workflows/build_CI_for_version1.1.yml @@ -54,38 +54,9 @@ jobs: echo "port is used" fi ./spdm_responder_emu --ver 1.1 & + sleep 5s ./spdm_requester_emu --ver 1.1 >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu --ver 1.1 & - ./spdm_requester_emu --ver 1.1 >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=990000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - - gcc_openssl_build: runs-on: ubuntu-latest steps: @@ -114,37 +85,9 @@ jobs: echo "port is used" fi ./spdm_responder_emu --ver 1.1 & + sleep 5s ./spdm_requester_emu --ver 1.1 >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu --ver 1.1 & - ./spdm_requester_emu --ver 1.1 >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=990000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" requester.log; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - VS2019_mbedtls_build: runs-on: windows-latest steps: @@ -169,6 +112,7 @@ jobs: run: | cd build/bin ./spdm_responder_emu --ver 1.1 & + sleep 5s ./spdm_requester_emu --ver 1.1 VS2019_openssl_build: @@ -196,4 +140,5 @@ jobs: run: | cd build/bin ./spdm_responder_emu --ver 1.1 & + sleep 5s ./spdm_requester_emu --ver 1.1 diff --git a/.github/workflows/chunk_check.yml b/.github/workflows/chunk_check.yml index 104eebc..44cb527 100644 --- a/.github/workflows/chunk_check.yml +++ b/.github/workflows/chunk_check.yml @@ -43,36 +43,9 @@ jobs: echo "port is used" fi ./spdm_responder_emu & + sleep 5s ./spdm_requester_emu >requester.log - - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu & - ./spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1200000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" "$filename"; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi + sleep 10s - name: Enable_chunk(transfer size inconsistent) run: | @@ -85,71 +58,15 @@ jobs: cd bin echo "requester (transfer_size = 42) <=> responder (transfer_size = 0x1200)" ./spdm_responder_emu & + sleep 5s ./../../build/bin/spdm_requester_emu >requester.log - filename=./../../build/bin/requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu & - ./../../build/bin/spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1200000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" "$filename"; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - sleep 10s echo "requester (transfer_size = 0x1200) <=> responder (transfer_size = 42)" ./../../build/bin/spdm_responder_emu & + sleep 5s ./spdm_requester_emu >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./../../build/bin/spdm_responder_emu & - ./spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1200000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" "$filename"; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - gcc_openssl_build: runs-on: ubuntu-latest steps: @@ -178,37 +95,9 @@ jobs: echo "port is used" fi ./spdm_responder_emu & + sleep 5s ./spdm_requester_emu >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu & - ./spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1200000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" "$filename"; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - - name: Enable_chunk(transfer size inconsistent) run: | mkdir build1 @@ -220,71 +109,15 @@ jobs: cd bin echo "requester (transfer_size = 42) <=> responder (transfer_size = 0x1200)" ./spdm_responder_emu & + sleep 5s ./../../build/bin/spdm_requester_emu >requester.log - filename=./../../build/bin/requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./spdm_responder_emu & - ./../../build/bin/spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1200000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" "$filename"; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - sleep 10s echo "requester (transfer_size = 0x1200) <=> responder (transfer_size = 42)" ./../../build/bin/spdm_responder_emu & + sleep 5s ./spdm_requester_emu >requester.log - filename=./requester.log - if [ ! -f "$filename" ]; - then - echo "Gen requester.log fail" - exit 1 - fi - if grep "Connect Error - 6f" requester.log - then - sleep 100s - echo -e "\n try connect again!!! \n" - ./../../build/bin/spdm_responder_emu & - ./spdm_requester_emu >requester.log - if [ ! -f "$filename" ]; - then - echo "Second Gen requester.log fail" - exit 1 - fi - fi - - minsize=1200000 - if [ `stat -c%s "$filename"` -lt $minsize ] || - ! grep "libspdm_stop_session - (nil)" "$filename"; - then - echo "requester run fail" - cat -n "$filename" - echo "requester.log size is `stat -c%s "$filename"`" - exit 1 - fi - VS2019_mbedtls_build: runs-on: windows-latest steps: @@ -309,6 +142,7 @@ jobs: run: | cd build/bin ./spdm_responder_emu & + sleep 5s ./spdm_requester_emu VS2019_openssl_build: @@ -336,4 +170,5 @@ jobs: run: | cd build/bin ./spdm_responder_emu & + sleep 5s ./spdm_requester_emu diff --git a/spdm_emu/spdm_requester_emu/spdm_requester_authentication.c b/spdm_emu/spdm_requester_emu/spdm_requester_authentication.c index a67dab2..f04e435 100644 --- a/spdm_emu/spdm_requester_emu/spdm_requester_authentication.c +++ b/spdm_emu/spdm_requester_emu/spdm_requester_authentication.c @@ -149,7 +149,7 @@ libspdm_return_t do_authentication_via_spdm(void) if (LIBSPDM_STATUS_IS_ERROR(status)) { return status; } - return LIBSPDM_STATUS_SUCCESS; + return LIBSPDM_STATUS_INVALID_PARAMETER; } #endif /*(LIBSPDM_ENABLE_CAPABILITY_CERT_CAP && LIBSPDM_ENABLE_CAPABILITY_CHAL_CAP)*/ diff --git a/spdm_emu/spdm_requester_emu/spdm_requester_emu.c b/spdm_emu/spdm_requester_emu/spdm_requester_emu.c index 41a9e90..7b7349d 100644 --- a/spdm_emu/spdm_requester_emu/spdm_requester_emu.c +++ b/spdm_emu/spdm_requester_emu/spdm_requester_emu.c @@ -87,6 +87,8 @@ bool platform_client_routine(uint16_t port_number) } } + result = false; + if (m_use_transport_layer == SOCKET_TRANSPORT_TYPE_PCI_DOE) { status = pci_doe_init_requester (); if (LIBSPDM_STATUS_IS_ERROR(status)) { @@ -167,11 +169,14 @@ bool platform_client_routine(uint16_t port_number) } /* Do test - end*/ + result = true; done: response_size = 0; - result = communicate_platform_data( - m_socket, SOCKET_SPDM_COMMAND_SHUTDOWN - m_exe_mode, - NULL, 0, &response, &response_size, NULL); + if (!communicate_platform_data( + m_socket, SOCKET_SPDM_COMMAND_SHUTDOWN - m_exe_mode, + NULL, 0, &response, &response_size, NULL)) { + return false; + } if (m_spdm_context != NULL) { #if LIBSPDM_FIPS_MODE @@ -196,11 +201,12 @@ bool platform_client_routine(uint16_t port_number) WSACleanup(); #endif - return true; + return result; } int main(int argc, char *argv[]) { + bool result; printf("%s version 0.1\n", "spdm_requester_emu"); srand((unsigned int)time(NULL)); @@ -208,14 +214,14 @@ int main(int argc, char *argv[]) if (m_use_transport_layer == SOCKET_TRANSPORT_TYPE_TCP) { /* Port number 4194 for SPDM */ - platform_client_routine(TCP_SPDM_PLATFORM_PORT); + result = platform_client_routine(TCP_SPDM_PLATFORM_PORT); } else { - platform_client_routine(DEFAULT_SPDM_PLATFORM_PORT); + result = platform_client_routine(DEFAULT_SPDM_PLATFORM_PORT); } printf("Client stopped\n"); close_pcap_packet_file(); - return 0; + return (!result); } diff --git a/spdm_emu/spdm_responder_emu/spdm_responder_emu.c b/spdm_emu/spdm_responder_emu/spdm_responder_emu.c index 0b70683..52063b7 100644 --- a/spdm_emu/spdm_responder_emu/spdm_responder_emu.c +++ b/spdm_emu/spdm_responder_emu/spdm_responder_emu.c @@ -229,6 +229,7 @@ bool platform_server_routine(uint16_t port_number) int main(int argc, char *argv[]) { libspdm_return_t status; + bool result; printf("%s version 0.1\n", "spdm_responder_emu"); srand((unsigned int)time(NULL)); @@ -237,23 +238,23 @@ int main(int argc, char *argv[]) m_spdm_context = spdm_server_init(); if (m_spdm_context == NULL) { - return 0; + return 1; } if (m_use_transport_layer == SOCKET_TRANSPORT_TYPE_PCI_DOE) { status = pci_doe_init_responder (); if (LIBSPDM_STATUS_IS_ERROR(status)) { printf("pci_doe_init_responder - %x\n", (uint32_t)status); - return 0; + return 1; } } if (m_use_transport_layer == SOCKET_TRANSPORT_TYPE_TCP) { /* The IANA has assigned port number 4194 for SPDM */ - platform_server_routine(TCP_SPDM_PLATFORM_PORT); + result = platform_server_routine(TCP_SPDM_PLATFORM_PORT); } else { - platform_server_routine(DEFAULT_SPDM_PLATFORM_PORT); + result = platform_server_routine(DEFAULT_SPDM_PLATFORM_PORT); } if (m_spdm_context != NULL) { @@ -261,7 +262,7 @@ int main(int argc, char *argv[]) if (!libspdm_export_fips_selftest_context_from_spdm_context( m_spdm_context, m_fips_selftest_context, libspdm_get_fips_selftest_context_size())) { - return 0; + return 1; } #endif /*LIBSPDM_FIPS_MODE*/ libspdm_deinit_context(m_spdm_context); @@ -272,5 +273,5 @@ int main(int argc, char *argv[]) printf("Server stopped\n"); close_pcap_packet_file(); - return 0; + return (!result); }