Skip to content

Commit

Permalink
Build: apollo6.sh test support
Browse files Browse the repository at this point in the history
  • Loading branch information
storypku committed Jun 23, 2020
1 parent 7516e91 commit e4741ac
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 37 deletions.
2 changes: 1 addition & 1 deletion scripts/apollo_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function determine_build_targets() {
targets_all="${targets_all} union ${build_targets}"
fi
done
echo "${targets_all}" | sed -e 's/^[[:space:]]*//'
echo "${targets_all}"
}

function _parse_cmdline_arguments() {
Expand Down
135 changes: 99 additions & 36 deletions scripts/apollo_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,46 @@ set -e
TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
source "${TOP_DIR}/scripts/apollo.bashrc"

##========== Perception: 7 test failures + 2 flaky ================##
PERCEPTION_EXCEPTIONS="\
except //modules/perception/lidar/lib/detection/lidar_point_pillars:point_pillars_test \
except //modules/perception/camera/test:camera_lib_obstacle_transformer_multicue_multicue_obstacle_transformer_test \
except //modules/perception/camera/test:camera_lib_obstacle_detector_yolo_yolo_obstacle_detector_test \
except //modules/perception/camera/test:camera_lib_obstacle_detector_yolo_region_output_test \
except //modules/perception/camera/test:camera_lib_lane_postprocessor_darkscnn_lane_postprocessor_test \
except //modules/perception/camera/test:camera_lib_lane_detector_darkscnn_lane_detector_test \
except //modules/perception/camera/test:camera_app_obstacle_camera_perception_test \
except //modules/perception/camera/test:camera_lib_lane_postprocessor_denseline_lane_postprocessor_test \
except //modules/perception/camera/test:camera_lib_lane_detector_denseline_lane_detector_test \
"

##============= Localization: 3 test failures ===================##
LOCALIZATION_EXCEPTIONS="\
except //modules/localization/ndt/ndt_locator:ndt_lidar_locator_test \
except //modules/localization/msf/local_pyramid_map/pyramid_map:pyramid_map_test \
except //modules/localization/msf/local_pyramid_map/pyramid_map:pyramid_map_pool_test \
"

##============== Prediction: 4 test failures ====================##
PREDICTION_EXCEPTIONS="\
except //modules/prediction/predictor/single_lane:single_lane_predictor_test \
except //modules/prediction/container/obstacles:obstacle_test \
except //modules/prediction/container/obstacles:obstacle_clusters_test \
except //modules/prediction/common:road_graph_test \
"

##====================== Planning: 7 test failures ===============##
PLANNING_EXCEPTIONS="\
except //modules/planning/tasks/learning_model:learning_model_inference_task_test \
except //modules/planning/reference_line:qp_spline_reference_line_smoother_test \
except //modules/planning/open_space/trajectory_smoother:dual_variable_warm_start_osqp_interface_test \
except //modules/planning/math/smoothing_spline:osqp_spline_2d_solver_test \
except //modules/planning/math/smoothing_spline:osqp_spline_1d_solver_test \
except //modules/planning/learning_based/model_inference:model_inference_test \
except //modules/planning/integration_tests:sunnyvale_big_loop_test \
"

##======================= Failed Test Cases are Listed Above ================##
ARCH="$(uname -m)"

: ${USE_ESD_CAN:=false}
Expand All @@ -12,60 +52,79 @@ CMDLINE_OPTIONS=
SHORTHAND_TARGETS=
DISABLED_TARGETS=

function determine_disabled_test_targets() {
local disabled=
local compo="$1"
if [[ -z "${compo}" || "${compo}" == "drivers" ]]; then
if ! ${USE_ESD_CAN} ; then
warning "ESD CAN library supplied by ESD Electronics doesn't exist."
warning "If you need ESD CAN, please refer to:"
warning " third_party/can_card_library/esd_can/README.md"
disabled="${disabled} except //modules/drivers/canbus/can_client/esd/..."
fi
elif [[ "${compo}" == "localization" && "${ARCH}" != "x86_64" ]]; then
# Skip msf for non-x86_64 platforms
function _disabled_test_targets_all() {
local disabled="${PERCEPTION_EXCEPTIONS}"
disabled="${disabled} ${PREDICTION_EXCEPTIONS}"
disabled="${disabled} ${LOCALIZATION_EXCEPTIONS}"
disabled="${disabled} ${PLANNING_EXCEPTIONS}"

if ! ${USE_ESD_CAN} ; then
warning "ESD CAN library supplied by ESD Electronics doesn't exist."
warning "If you need ESD CAN, please refer to:"
warning " third_party/can_card_library/esd_can/README.md"
disabled="${disabled} except //modules/drivers/canbus/can_client/esd/..."
fi
if [[ "${ARCH}" != "x86_64" ]]; then
disabled="${disabled} except //modules/localization/msf/..."
fi
echo "${disabled}"
}

# bazel run //modules/planning/tools:inference_demo crash
function determine_disabled_targets() {
if [[ "$#" -eq 0 ]]; then
_disabled_test_targets_all
return
fi

local disabled=
for compo in $@ ; do
if [[ "${compo}" == "drivers" ]]; then
if ! ${USE_ESD_CAN} ; then
warning "ESD CAN library supplied by ESD Electronics doesn't exist."
warning "If you need ESD CAN, please refer to:"
warning " third_party/can_card_library/esd_can/README.md"
disabled="${disabled} except //modules/drivers/canbus/can_client/esd/..."
fi
elif [[ "${compo}" == "localization" ]]; then
if [[ "${ARCH}" != "x86_64" ]]; then
disabled="${disabled} except //modules/localization/msf/..."
fi
disabled="${disabled} ${LOCALIZATION_EXCEPTIONS}"
elif [[ "${compo}" == "prediction" ]]; then
disabled="${disabled} ${PREDICTION_EXCEPTIONS}"
elif [[ "${compo}" == "planning" ]]; then
disabled="${disabled} ${PLANNING_EXCEPTIONS}"
elif [[ "${compo}" == "perception" ]]; then
disabled="${disabled} ${PERCEPTION_EXCEPTIONS}"
fi
done

echo "${disabled}"
}

function determine_test_targets() {
local targets_all
if [[ "$#" -eq 0 ]]; then
local exceptions=
if ! ${USE_ESD_CAN}; then
exceptions="$(determine_disabled_bazel_targets)"
fi
targets_all="//modules/... union //cyber/... ${exceptions}"
targets_all="//modules/... union //cyber/..."
echo "${targets_all}"
return
fi

for compo in $@ ; do
local build_targets
if [[ "${compo}" == "drivers" ]]; then
local exceptions=
if ! ${USE_ESD_CAN}; then
exceptions="$(determine_disabled_test_targets ${compo})"
fi
build_targets="//modules/drivers/... ${exceptions}"
elif [[ "${compo}" == "cyber" ]]; then
if [[ "${ARCH}" == "x86_64" ]]; then
build_targets="//cyber/... union //modules/tools/visualizer/..."
else
build_targets="//cyber/..."
fi
local test_targets
if [[ "${compo}" == "cyber" ]]; then
test_targets="//cyber/..."
elif [[ -d "${APOLLO_ROOT_DIR}/modules/${compo}" ]]; then
build_targets="//modules/${compo}/..."
test_targets="//modules/${compo}/..."
else
error "Oops, no such component '${compo}' under <APOLLO_ROOT_DIR>/modules/ . Exiting ..."
exit 1
fi
if [ -z "${targets_all}" ]; then
targets_all="${build_targets}"
targets_all="${test_targets}"
else
targets_all="${targets_all} union ${build_targets}"
targets_all="${targets_all} union ${test_targets}"
fi
done
echo "${targets_all}" | sed -e 's/^[[:space:]]*//'
Expand Down Expand Up @@ -124,12 +183,15 @@ function bazel_test() {
local test_targets
test_targets="$(determine_test_targets ${SHORTHAND_TARGETS})"

local disabled_targets
disabled_targets="$(determine_disabled_targets ${SHORTHAND_TARGETS})"

info "Test Overview: "
info "${TAB}Bazel Options: ${GREEN}${CMDLINE_OPTIONS}${NO_COLOR}"
info "${TAB}Test Options: ${GREEN}${CMDLINE_OPTIONS}${NO_COLOR}"
info "${TAB}Test Targets: ${GREEN}${test_targets}${NO_COLOR}"
exit 0
info "${TAB}Disabled: ${YELLOW}${disabled_targets}${NO_COLOR}"

_run_bazel_test_impl "${CMDLINE_OPTIONS}" "$(bazel query ${test_targets})"
_run_bazel_test_impl "${CMDLINE_OPTIONS}" "$(bazel query ${test_targets} ${disabled_targets})"
}

function main() {
Expand All @@ -143,3 +205,4 @@ function main() {
}

main "$@"

0 comments on commit e4741ac

Please sign in to comment.