|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -e # Exit on any error |
| 4 | + |
| 5 | +echo "=== Building Wheel Package ===" |
| 6 | +python setup.py bdist_wheel |
| 7 | + |
| 8 | +# Find the wheel file |
| 9 | +WHEEL_FILE=$(ls dist/*.whl | head -n 1) |
| 10 | +echo "Found wheel: $WHEEL_FILE" |
| 11 | + |
| 12 | +echo "=== Checking for expected .so files ===" |
| 13 | +SO_FILES=$(unzip -l "$WHEEL_FILE" | grep "\.so" | grep "qualcomm") |
| 14 | + |
| 15 | +# Check for the three expected .so files |
| 16 | +if echo "$SO_FILES" | grep -q "executorch/backends/qualcomm/qnn_backend.cpython-310-x86_64-linux-gnu.so" && \ |
| 17 | + echo "$SO_FILES" | grep -q "executorch/backends/qualcomm/python/PyQnnManagerAdaptor.cpython-310-x86_64-linux-gnu.so" && \ |
| 18 | + echo "$SO_FILES" | grep -q "executorch/backends/qualcomm/python/PyQnnWrapperAdaptor.cpython-310-x86_64-linux-gnu.so"; then |
| 19 | + echo "All expected .so files found in wheel" |
| 20 | +else |
| 21 | + echo "ERROR: Missing expected .so files" |
| 22 | + exit 1 |
| 23 | +fi |
| 24 | + |
| 25 | +# Create a temporary directory for our test environment |
| 26 | +TEMP_ENV_DIR=$(mktemp -d) |
| 27 | +echo "Using temporary directory: $TEMP_ENV_DIR" |
| 28 | + |
| 29 | +echo "=== Creating and testing in conda environment ===" |
| 30 | +conda create -y -p "$TEMP_ENV_DIR/env" python=3.10 |
| 31 | +conda run -p "$TEMP_ENV_DIR/env" pip install "$WHEEL_FILE" |
| 32 | + |
| 33 | +echo "=== Testing import without SDK download ===" |
| 34 | +conda run -p "$TEMP_ENV_DIR/env" python -c "import executorch; print('executorch imported successfully')" |
| 35 | + |
| 36 | +# Check that SDK directory doesn't exist after first import |
| 37 | +SDK_PATH="$TEMP_ENV_DIR/env/lib/python3.10/site-packages/executorch/backends/qualcomm/sdk" |
| 38 | +if [ -d "$SDK_PATH" ]; then |
| 39 | + echo "ERROR: SDK directory exists after first import: $SDK_PATH" |
| 40 | + exit 1 |
| 41 | +else |
| 42 | + echo "SDK directory correctly doesn't exist after first import" |
| 43 | +fi |
| 44 | + |
| 45 | +echo "=== Testing import that should trigger SDK download ===" |
| 46 | +conda run -p "$TEMP_ENV_DIR/env" python -c "import executorch.backends.qualcomm; print('executorch.backends.qualcomm imported successfully')" |
| 47 | + |
| 48 | +# Check that SDK directory exists after second import |
| 49 | +if [ -d "$SDK_PATH" ]; then |
| 50 | + echo "SDK directory correctly exists after second import: $SDK_PATH" |
| 51 | +else |
| 52 | + echo "ERROR: SDK directory doesn't exist after second import" |
| 53 | + exit 1 |
| 54 | +fi |
| 55 | + |
| 56 | +echo "=== Running model generation script ===" |
| 57 | +conda run -p "$TEMP_ENV_DIR/env" python script.py |
| 58 | + |
| 59 | +# Check if linear.pte file was created |
| 60 | +if [ -f "linear.pte" ]; then |
| 61 | + echo "Model file linear.pte successfully created" |
| 62 | +else |
| 63 | + echo "ERROR: Model file linear.pte was not created" |
| 64 | + exit 1 |
| 65 | +fi |
| 66 | + |
| 67 | +echo "=== Cleaning up ===" |
| 68 | +conda env remove -p "$TEMP_ENV_DIR/env" -y |
| 69 | +rm -rf "$TEMP_ENV_DIR" |
| 70 | + |
| 71 | +echo "=== All tests passed! ===" |
0 commit comments