Skip to content

Commit

Permalink
Fix Hexagon build using ci.py (#11304)
Browse files Browse the repository at this point in the history
* Add output directory

add post build for hexagon

fix -net=host for docker

* remove --net by default
  • Loading branch information
mehrdadh authored Jun 3, 2022
1 parent 8823757 commit 6dbdf2e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
6 changes: 5 additions & 1 deletion tests/scripts/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ def generate_command(
options: Dict[str, Option],
help: str,
precheck: Optional[Callable[[], None]] = None,
post_build: Optional[List[str]] = None,
):
"""
Helper to generate CLIs that:
Expand Down Expand Up @@ -378,6 +379,9 @@ def fn(
f"./tests/scripts/task_build.py --build-dir {get_build_dir(name)}",
]

if post_build is not None:
scripts += post_build

# Check that a test suite was not used alongside specific test names
if any(v for v in kwargs.values()) and tests is not None:
option_flags = ", ".join([f"--{k}" for k in options.keys()])
Expand Down Expand Up @@ -624,12 +628,12 @@ def add_subparser(
generate_command(
name="hexagon",
help="Run Hexagon build and test(s)",
post_build=["./tests/scripts/task_build_hexagon_api.sh --output build-hexagon"],
options={
"cpp": CPP_UNITTEST,
"test": (
"run Hexagon API/Python tests",
[
"./tests/scripts/task_build_hexagon_api.sh",
"./tests/scripts/task_python_hexagon.sh",
],
),
Expand Down
16 changes: 10 additions & 6 deletions tests/scripts/task_build_hexagon_api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,35 @@
set -e
set -u

output_directory_parent=$(realpath ${PWD}/build)
if [ $# -ge 1 ] && [[ "$1" == "--output" ]]; then
shift 1
output_directory_parent=$(realpath $1)
shift 1
fi
output_directory="${output_directory_parent}/hexagon_api_output"
rm -rf ${output_directory}

use_cache=false
if [ $# -ge 1 ] && [[ "$1" == "--use-cache" ]]; then
use_cache=true
shift 1
fi

cd apps/hexagon_api

if [ "$use_cache" = false ]; then
rm -rf build
fi

mkdir -p build
cd build

output_binary_directory=$(realpath ${PWD}/../../../build/hexagon_api_output)
rm -rf ${output_binary_directory}

cmake -DANDROID_ABI=arm64-v8a \
-DANDROID_PLATFORM=android-28 \
-DUSE_ANDROID_TOOLCHAIN="${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" \
-DUSE_HEXAGON_ARCH=v68 \
-DUSE_HEXAGON_SDK="${HEXAGON_SDK_ROOT}" \
-DUSE_HEXAGON_TOOLCHAIN="${HEXAGON_TOOLCHAIN}" \
-DUSE_OUTPUT_BINARY_DIR="${output_binary_directory}" \
-DUSE_OUTPUT_BINARY_DIR="${output_directory}" \
-DUSE_HEXAGON_GTEST="${HEXAGON_SDK_ROOT}/utils/googletest/gtest" ..

make -j$(nproc)

0 comments on commit 6dbdf2e

Please sign in to comment.