|
| 1 | +name: hostap and wpa supplicant Tests |
| 2 | + |
| 3 | +# START OF COMMON SECTION |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [ 'master', 'main', 'release/**' ] |
| 7 | + pull_request: |
| 8 | + branches: [ '*' ] |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | +# END OF COMMON SECTION |
| 14 | + |
| 15 | +jobs: |
| 16 | + build_wolfprovider: |
| 17 | + uses: ./.github/workflows/build-wolfprovider.yml |
| 18 | + with: |
| 19 | + wolfssl_ref: ${{ matrix.wolfssl_ref }} |
| 20 | + openssl_ref: ${{ matrix.openssl_ref }} |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + wolfssl_ref: [ 'master', 'v5.8.0-stable' ] |
| 24 | + openssl_ref: [ 'openssl-3.5.0' ] |
| 25 | + |
| 26 | + test_hostap: |
| 27 | + runs-on: ubuntu-22.04 |
| 28 | + needs: build_wolfprovider |
| 29 | + # This should be a safe limit for the tests to run. |
| 30 | + timeout-minutes: 90 |
| 31 | + strategy: |
| 32 | + matrix: |
| 33 | + hostap_ref: [ 'main' ] |
| 34 | + wolfssl_ref: [ 'master', 'v5.8.0-stable' ] |
| 35 | + openssl_ref: [ 'openssl-3.5.0' ] |
| 36 | + force_fail: [ 'WOLFPROV_FORCE_FAIL=1', '', 'OPENSSL' ] |
| 37 | + |
| 38 | + steps: |
| 39 | + # Checkout the source so we can run the check-workflow-result script. |
| 40 | + - name: Checkout wolfProvider |
| 41 | + uses: actions/checkout@v4 |
| 42 | + with: |
| 43 | + fetch-depth: 1 |
| 44 | + |
| 45 | + - name: Retrieving wolfProvider from cache |
| 46 | + uses: actions/cache/restore@v4 |
| 47 | + id: wolfprov-cache-restore |
| 48 | + with: |
| 49 | + path: | |
| 50 | + wolfssl-install |
| 51 | + wolfprov-install |
| 52 | + openssl-install/lib64 |
| 53 | + openssl-install/include |
| 54 | + openssl-install/bin |
| 55 | + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} |
| 56 | + fail-on-cache-miss: true |
| 57 | + |
| 58 | + - name: Install hostap dependencies |
| 59 | + env: |
| 60 | + LD_LIBRARY_PATH: "$GITHUB_WORKSPACE/openssl-install/lib64:$GITHUB_WORKSPACE/wolfprov-install/lib:$LD_LIBRARY_PATH" |
| 61 | + LDFLAGS: "-L$GITHUB_WORKSPACE/openssl-install/lib64" |
| 62 | + CFLAGS: "-I$GITHUB_WORKSPACE/openssl-install/include" |
| 63 | + PKG_CONFIG_PATH: "$GITHUB_WORKSPACE/openssl-install/lib64/pkgconfig" |
| 64 | + run: | |
| 65 | + sudo apt-get update |
| 66 | + sudo apt-get install -y libpcap0.8 libpcap-dev curl libcurl4-openssl-dev \ |
| 67 | + libnl-3-dev binutils-dev libssl-dev libiberty-dev libnl-genl-3-dev \ |
| 68 | + libnl-route-3-dev libdbus-1-dev bridge-utils tshark python3-pycryptodome \ |
| 69 | + libsqlite3-dev libzstd1 wireless-tools iw |
| 70 | +
|
| 71 | + # Uninstall system cryptography and reinstall with custom OpenSSL |
| 72 | + sudo apt-get remove -y python3-cryptography |
| 73 | + pip install --no-cache-dir --force-reinstall cryptography |
| 74 | +
|
| 75 | + - name: Checkout hostap |
| 76 | + run: git clone git://w1.fi/hostap.git hostap |
| 77 | + |
| 78 | + - name: Checkout linux |
| 79 | + uses: actions/checkout@v4 |
| 80 | + with: |
| 81 | + repository: torvalds/linux |
| 82 | + path: linux |
| 83 | + ref: master |
| 84 | + |
| 85 | + - name: Compile linux |
| 86 | + run: | |
| 87 | + cp $GITHUB_WORKSPACE/hostap/tests/hwsim/vm/kernel-config.uml linux/.config |
| 88 | + cd linux |
| 89 | + yes "" | ARCH=um make -j $(nproc) |
| 90 | +
|
| 91 | + - name: Update config |
| 92 | + working-directory: hostap/tests/hwsim |
| 93 | + run: | |
| 94 | + cat << EOF >> example-hostapd.config |
| 95 | + # Custom OpenSSL installation paths |
| 96 | + CFLAGS += -I$GITHUB_WORKSPACE/openssl-install/include |
| 97 | + LDFLAGS += -L$GITHUB_WORKSPACE/openssl-install/lib64 |
| 98 | + # Override OpenSSL libraries to use custom installation with rpath |
| 99 | + LIBS += -L$GITHUB_WORKSPACE/openssl-install/lib64 -Wl,-rpath,$GITHUB_WORKSPACE/openssl-install/lib64 |
| 100 | + EOF |
| 101 | + cat << EOF >> example-wpa_supplicant.config |
| 102 | + # Custom OpenSSL installation paths |
| 103 | + CFLAGS += -I$GITHUB_WORKSPACE/openssl-install/include |
| 104 | + LDFLAGS += -L$GITHUB_WORKSPACE/openssl-install/lib64 |
| 105 | + # Override OpenSSL libraries to use custom installation with rpath |
| 106 | + LIBS += -L$GITHUB_WORKSPACE/openssl-install/lib64 -Wl,-rpath,$GITHUB_WORKSPACE/openssl-install/lib64 |
| 107 | + EOF |
| 108 | +
|
| 109 | + - name: Setup non-WPFF environment |
| 110 | + working-directory: hostap/tests/hwsim |
| 111 | + if: matrix.force_fail == '' |
| 112 | + run: | |
| 113 | + sed -i '115r /dev/stdin' vm/inside.sh << EOF |
| 114 | + echo "setting env variables" |
| 115 | + # Set up wolfSSL environment variables |
| 116 | + # In UML mode, we can access the host filesystem directly |
| 117 | + echo "Setting up wolfSSL environment in UML mode" |
| 118 | + # Use the host filesystem paths directly |
| 119 | + export LD_LIBRARY_PATH="$GITHUB_WORKSPACE/openssl-install/lib64:$GITHUB_WORKSPACE/wolfprov-install/lib:$LD_LIBRARY_PATH" |
| 120 | + export OPENSSL_CONF="$GITHUB_WORKSPACE/provider.conf" |
| 121 | + export OPENSSL_MODULES="$GITHUB_WORKSPACE/wolfprov-install/lib" |
| 122 | + export CRYPTOGRAPHY_OPENSSL_NO_LEGACY=1 |
| 123 | + echo "wolfSSL environment variables set:" |
| 124 | + echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" |
| 125 | + echo "OPENSSL_CONF: $OPENSSL_CONF" |
| 126 | + echo "OPENSSL_MODULES: $OPENSSL_MODULES" |
| 127 | +
|
| 128 | + # Test if wolfProvider is available |
| 129 | + echo "Testing OpenSSL providers:" |
| 130 | + $GITHUB_WORKSPACE/openssl-install/bin/openssl list -providers |
| 131 | + EOF |
| 132 | +
|
| 133 | + - name: Setup WPFF environment |
| 134 | + working-directory: hostap/tests/hwsim |
| 135 | + if: matrix.force_fail == 'WOLFPROV_FORCE_FAIL=1' |
| 136 | + run: | |
| 137 | + sed -i '115r /dev/stdin' vm/inside.sh << EOF |
| 138 | + echo "setting env variables" |
| 139 | + # Set up wolfSSL environment variables |
| 140 | + # In UML mode, we can access the host filesystem directly |
| 141 | + echo "Setting up wolfSSL environment in UML mode" |
| 142 | + # Use the host filesystem paths directly |
| 143 | + export LD_LIBRARY_PATH="$GITHUB_WORKSPACE/openssl-install/lib64:$GITHUB_WORKSPACE/wolfprov-install/lib:$LD_LIBRARY_PATH" |
| 144 | + export OPENSSL_CONF="$GITHUB_WORKSPACE/provider.conf" |
| 145 | + export OPENSSL_MODULES="$GITHUB_WORKSPACE/wolfprov-install/lib" |
| 146 | + export CRYPTOGRAPHY_OPENSSL_NO_LEGACY=1 |
| 147 | + export WOLFPROV_FORCE_FAIL=1 |
| 148 | + echo "wolfSSL environment variables set:" |
| 149 | + echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" |
| 150 | + echo "OPENSSL_CONF: $OPENSSL_CONF" |
| 151 | + echo "OPENSSL_MODULES: $OPENSSL_MODULES" |
| 152 | +
|
| 153 | + # Test if wolfProvider is available |
| 154 | + echo "Testing OpenSSL providers:" |
| 155 | + $GITHUB_WORKSPACE/openssl-install/bin/openssl list -providers |
| 156 | + EOF |
| 157 | +
|
| 158 | +
|
| 159 | + - name: Update certs |
| 160 | + working-directory: hostap/tests/hwsim/auth_serv |
| 161 | + run: ./update.sh |
| 162 | + |
| 163 | + - name: Build hostap and wpa_supplicant |
| 164 | + working-directory: hostap/tests/hwsim/ |
| 165 | + run: ./build.sh |
| 166 | + |
| 167 | + - name: Verify openssl binaries linked |
| 168 | + working-directory: hostap |
| 169 | + run: | |
| 170 | + ldd hostapd/hostapd | grep ssl |
| 171 | + ldd wpa_supplicant/wpa_supplicant | grep ssl |
| 172 | +
|
| 173 | + - name: Run tests |
| 174 | + id: testing |
| 175 | + working-directory: hostap/tests/hwsim/ |
| 176 | + continue-on-error: true |
| 177 | + run: | |
| 178 | + set +e |
| 179 | + cat << EOF >> vm/vm-config |
| 180 | + KERNELDIR=$GITHUB_WORKSPACE/linux |
| 181 | + KVMARGS="-cpu host" |
| 182 | + EOF |
| 183 | + find . -name "*.py" -path "*/test_*" | xargs grep "def test_" | sed 's/.*def test_\([^(]*\).*/\1/' > test_list.txt |
| 184 | + echo "=== Debug: Running tests in batches ===" |
| 185 | + batch_count=0 |
| 186 | + touch final_failed_tests.log |
| 187 | + while mapfile -t -n 50 ary && ((${#ary[@]})); do |
| 188 | + batch_count=$((batch_count + 1)) |
| 189 | + echo "Batch count = $batch_count" |
| 190 | + TESTS=$(printf '%s\n' "${ary[@]}" | tr '\n' ' ') |
| 191 | + ./vm/parallel-vm.py --nocurses $(nproc) $TESTS || HWSIM_RES=$? |
| 192 | + #echo "GREPPING FOR libwolfprov" |
| 193 | + #grep -rA5 "Testing OpenSSL providers:" /tmp/hwsim-test-logs |
| 194 | + if [ "$HWSIM_RES" -ne "0" ]; then |
| 195 | + # Let's re-run the failing tests. We gather the failed tests from the log file. |
| 196 | + FAILED_TESTS=$(grep 'failed tests' /tmp/hwsim-test-logs/*-parallel.log | sed 's/failed tests: //' | tr ' ' '\n' | sort | uniq | tr '\n' ' ') |
| 197 | + RETRY_RES=0 |
| 198 | + ./vm/parallel-vm.py --nocurses $(nproc) $FAILED_TESTS || RETRY_RES=$? |
| 199 | +
|
| 200 | + if [ "$RETRY_RES" -ne "0" ]; then |
| 201 | + echo "$FAILED_TESTS" >> final_failed_tests.log |
| 202 | + fi |
| 203 | + fi |
| 204 | + done < test_list.txt |
| 205 | +
|
| 206 | + echo "=== FAILED TESTS: $(wc -l < final_failed_tests.log || echo 0)" |
| 207 | + cat final_failed_tests.log || true |
0 commit comments