Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
a946e824
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a946e824
编写于
8月 15, 2017
作者:
D
Dong Li
提交者:
lianglia-apollo
8月 15, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
planning: added end to end comparision in integration tests.
上级
53b1e0f1
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
56219 addition
and
21 deletion
+56219
-21
modules/control/integration_tests/control_test_base.cc
modules/control/integration_tests/control_test_base.cc
+3
-0
modules/control/integration_tests/simple_control_test.cc
modules/control/integration_tests/simple_control_test.cc
+4
-1
modules/planning/integration_tests/garage_test.cc
modules/planning/integration_tests/garage_test.cc
+2
-3
modules/planning/integration_tests/planning_test_base.cc
modules/planning/integration_tests/planning_test_base.cc
+52
-2
modules/planning/integration_tests/planning_test_base.h
modules/planning/integration_tests/planning_test_base.h
+12
-1
modules/planning/optimizer/dp_poly_path/dp_road_graph_test.cc
...les/planning/optimizer/dp_poly_path/dp_road_graph_test.cc
+11
-8
modules/planning/optimizer/dp_st_speed/dp_st_graph_test.cc
modules/planning/optimizer/dp_st_speed/dp_st_graph_test.cc
+4
-6
modules/planning/testdata/dp_road_graph_test/result_speed_road_graph_0.pb.txt
...tdata/dp_road_graph_test/result_speed_road_graph_0.pb.txt
+18697
-0
modules/planning/testdata/dp_st_speed_test/result_dp_st_graph_test_0.pb.txt
...estdata/dp_st_speed_test/result_dp_st_graph_test_0.pb.txt
+18697
-0
modules/planning/testdata/garage_test/result_Stop_0.pb.txt
modules/planning/testdata/garage_test/result_Stop_0.pb.txt
+18737
-0
未找到文件。
modules/control/integration_tests/control_test_base.cc
浏览文件 @
a946e824
...
@@ -116,7 +116,10 @@ bool ControlTestBase::test_control() {
...
@@ -116,7 +116,10 @@ bool ControlTestBase::test_control() {
}
}
void
ControlTestBase
::
trim_control_command
(
ControlCommand
*
origin
)
{
void
ControlTestBase
::
trim_control_command
(
ControlCommand
*
origin
)
{
origin
->
mutable_header
()
->
clear_radar_timestamp
();
origin
->
mutable_header
()
->
clear_lidar_timestamp
();
origin
->
mutable_header
()
->
clear_timestamp_sec
();
origin
->
mutable_header
()
->
clear_timestamp_sec
();
origin
->
mutable_header
()
->
clear_camera_timestamp
();
}
}
bool
ControlTestBase
::
test_control
(
const
std
::
string
&
test_case_name
,
bool
ControlTestBase
::
test_control
(
const
std
::
string
&
test_case_name
,
...
...
modules/control/integration_tests/simple_control_test.cc
浏览文件 @
a946e824
...
@@ -37,7 +37,6 @@ class SimpleControlTest : public ControlTestBase {
...
@@ -37,7 +37,6 @@ class SimpleControlTest : public ControlTestBase {
public:
public:
virtual
void
SetUp
()
{
virtual
void
SetUp
()
{
FLAGS_test_data_dir
=
"modules/control/testdata/simple_control_test/"
;
FLAGS_test_data_dir
=
"modules/control/testdata/simple_control_test/"
;
ControlTestBase
::
SetUp
();
}
}
};
};
...
@@ -47,6 +46,7 @@ TEST_F(SimpleControlTest, simple_test) {
...
@@ -47,6 +46,7 @@ TEST_F(SimpleControlTest, simple_test) {
FLAGS_test_pad_file
=
"1_pad.pb.txt"
;
FLAGS_test_pad_file
=
"1_pad.pb.txt"
;
FLAGS_test_planning_file
=
"1_planning.pb.txt"
;
FLAGS_test_planning_file
=
"1_planning.pb.txt"
;
FLAGS_test_chassis_file
=
"1_chassis.pb.txt"
;
FLAGS_test_chassis_file
=
"1_chassis.pb.txt"
;
ControlTestBase
::
SetUp
();
RUN_GOLDEN_TEST
;
RUN_GOLDEN_TEST
;
}
}
...
@@ -55,6 +55,7 @@ TEST_F(SimpleControlTest, state_exact_match) {
...
@@ -55,6 +55,7 @@ TEST_F(SimpleControlTest, state_exact_match) {
FLAGS_test_pad_file
=
"1_pad.pb.txt"
;
FLAGS_test_pad_file
=
"1_pad.pb.txt"
;
FLAGS_test_planning_file
=
"1_planning.pb.txt"
;
FLAGS_test_planning_file
=
"1_planning.pb.txt"
;
FLAGS_test_chassis_file
=
"1_chassis.pb.txt"
;
FLAGS_test_chassis_file
=
"1_chassis.pb.txt"
;
ControlTestBase
::
SetUp
();
RUN_GOLDEN_TEST
;
RUN_GOLDEN_TEST
;
}
}
...
@@ -63,6 +64,7 @@ TEST_F(SimpleControlTest, pad_reset) {
...
@@ -63,6 +64,7 @@ TEST_F(SimpleControlTest, pad_reset) {
FLAGS_test_pad_file
=
"2_pad.pb.txt"
;
FLAGS_test_pad_file
=
"2_pad.pb.txt"
;
FLAGS_test_planning_file
=
"1_planning.pb.txt"
;
FLAGS_test_planning_file
=
"1_planning.pb.txt"
;
FLAGS_test_chassis_file
=
"1_chassis.pb.txt"
;
FLAGS_test_chassis_file
=
"1_chassis.pb.txt"
;
ControlTestBase
::
SetUp
();
RUN_GOLDEN_TEST
;
RUN_GOLDEN_TEST
;
}
}
...
@@ -72,6 +74,7 @@ TEST_F(SimpleControlTest, monitor_fatal) {
...
@@ -72,6 +74,7 @@ TEST_F(SimpleControlTest, monitor_fatal) {
FLAGS_test_planning_file
=
"1_planning.pb.txt"
;
FLAGS_test_planning_file
=
"1_planning.pb.txt"
;
FLAGS_test_chassis_file
=
"1_chassis.pb.txt"
;
FLAGS_test_chassis_file
=
"1_chassis.pb.txt"
;
FLAGS_test_monitor_file
=
"1_monitor.pb.txt"
;
FLAGS_test_monitor_file
=
"1_monitor.pb.txt"
;
ControlTestBase
::
SetUp
();
RUN_GOLDEN_TEST
;
RUN_GOLDEN_TEST
;
}
}
...
...
modules/planning/integration_tests/garage_test.cc
浏览文件 @
a946e824
...
@@ -41,6 +41,7 @@ class GarageTest : public PlanningTestBase {
...
@@ -41,6 +41,7 @@ class GarageTest : public PlanningTestBase {
public:
public:
virtual
void
SetUp
()
{
virtual
void
SetUp
()
{
FLAGS_map_file_path
=
"modules/planning/testdata/base_map.txt"
;
FLAGS_map_file_path
=
"modules/planning/testdata/base_map.txt"
;
FLAGS_test_data_dir
=
"modules/planning/testdata/garage_test/"
;
}
}
};
};
...
@@ -54,10 +55,8 @@ TEST_F(GarageTest, Stop) {
...
@@ -54,10 +55,8 @@ TEST_F(GarageTest, Stop) {
FLAGS_test_chassis_file
=
FLAGS_test_chassis_file
=
"modules/planning/testdata/garage_test/"
"modules/planning/testdata/garage_test/"
"stop_obstacle_chassis.pb.txt"
;
"stop_obstacle_chassis.pb.txt"
;
// EXPECT_DEATH(PlanningTestBase::SetUp(), ".*SetUpAdapters.*");
PlanningTestBase
::
SetUp
();
PlanningTestBase
::
SetUp
();
RunPlanning
();
RUN_GOLDEN_TEST
;
ASSERT_TRUE
(
adc_trajectory_
!=
nullptr
);
}
}
}
// namespace planning
}
// namespace planning
...
...
modules/planning/integration_tests/planning_test_base.cc
浏览文件 @
a946e824
...
@@ -24,6 +24,9 @@ namespace planning {
...
@@ -24,6 +24,9 @@ namespace planning {
using
common
::
adapter
::
AdapterManager
;
using
common
::
adapter
::
AdapterManager
;
DEFINE_string
(
test_data_dir
,
""
,
"the test data folder"
);
DEFINE_bool
(
test_update_golden_log
,
false
,
"true to update decision golden log file."
);
DEFINE_string
(
test_routing_response_file
,
DEFINE_string
(
test_routing_response_file
,
"modules/planning/testdata/garage_routing.pb.txt"
,
"modules/planning/testdata/garage_routing.pb.txt"
,
"The routing file used in test"
);
"The routing file used in test"
);
...
@@ -45,7 +48,8 @@ void PlanningTestBase::SetUpTestCase() {
...
@@ -45,7 +48,8 @@ void PlanningTestBase::SetUpTestCase() {
FLAGS_test_localization_file
=
FLAGS_test_localization_file
=
"modules/planning/testdata/garage_localization.pb.txt"
;
"modules/planning/testdata/garage_localization.pb.txt"
;
FLAGS_test_chassis_file
=
"modules/planning/testdata/garage_chassis.pb.txt"
,
FLAGS_test_chassis_file
=
"modules/planning/testdata/garage_chassis.pb.txt"
,
FLAGS_test_prediction_file
=
"modules/planning/testdata/garage_prediction.pb.txt"
,
FLAGS_test_prediction_file
=
"modules/planning/testdata/garage_prediction.pb.txt"
,
FLAGS_v
=
4
;
FLAGS_v
=
4
;
}
}
...
@@ -91,9 +95,55 @@ void PlanningTestBase::SetUp() {
...
@@ -91,9 +95,55 @@ void PlanningTestBase::SetUp() {
planning_
.
Init
();
planning_
.
Init
();
}
}
void
PlanningTestBase
::
RunPlanning
()
{
void
PlanningTestBase
::
TrimPlanning
(
ADCTrajectory
*
origin
)
{
origin
->
mutable_latency_stats
()
->
Clear
();
origin
->
mutable_header
()
->
clear_radar_timestamp
();
origin
->
mutable_header
()
->
clear_lidar_timestamp
();
origin
->
mutable_header
()
->
clear_timestamp_sec
();
origin
->
mutable_header
()
->
clear_camera_timestamp
();
}
bool
PlanningTestBase
::
RunPlanning
(
const
std
::
string
&
test_case_name
,
int
case_num
)
{
const
std
::
string
golden_result_file
=
apollo
::
common
::
util
::
StrCat
(
"result_"
,
test_case_name
,
"_"
,
case_num
,
".pb.txt"
);
std
::
string
tmp_golden_path
=
"/tmp/"
+
golden_result_file
;
std
::
string
full_golden_path
=
FLAGS_test_data_dir
+
"/"
+
golden_result_file
;
planning_
.
RunOnce
();
planning_
.
RunOnce
();
adc_trajectory_
=
AdapterManager
::
GetPlanning
()
->
GetLatestPublished
();
adc_trajectory_
=
AdapterManager
::
GetPlanning
()
->
GetLatestPublished
();
if
(
!
adc_trajectory_
)
{
AERROR
<<
" did not get latest adc trajectory"
;
return
false
;
}
TrimPlanning
(
adc_trajectory_
);
if
(
FLAGS_test_update_golden_log
)
{
AINFO
<<
"The golden file is "
<<
tmp_golden_path
<<
" Remember to:
\n
"
<<
"mv "
<<
tmp_golden_path
<<
" "
<<
FLAGS_test_data_dir
<<
"
\n
"
<<
"git add "
<<
FLAGS_test_data_dir
<<
"/"
<<
golden_result_file
;
::
apollo
::
common
::
util
::
SetProtoToASCIIFile
(
*
adc_trajectory_
,
golden_result_file
);
}
else
{
ADCTrajectory
golden_result
;
bool
load_success
=
::
apollo
::
common
::
util
::
GetProtoFromASCIIFile
(
full_golden_path
,
&
golden_result
);
if
(
!
load_success
)
{
AERROR
<<
"Failed to load golden file: "
<<
full_golden_path
;
::
apollo
::
common
::
util
::
SetProtoToASCIIFile
(
*
adc_trajectory_
,
tmp_golden_path
);
AINFO
<<
"Current result is written to "
<<
tmp_golden_path
;
return
false
;
}
bool
same_result
=
::
apollo
::
common
::
util
::
IsProtoEqual
(
golden_result
,
*
adc_trajectory_
);
if
(
!
same_result
)
{
std
::
string
tmp_planning_file
=
tmp_golden_path
+
".tmp"
;
::
apollo
::
common
::
util
::
SetProtoToASCIIFile
(
*
adc_trajectory_
,
tmp_planning_file
);
AERROR
<<
"found diff "
<<
tmp_planning_file
<<
" "
<<
full_golden_path
;
return
false
;
}
}
return
true
;
}
}
void
PlanningTestBase
::
export_sl_points
(
void
PlanningTestBase
::
export_sl_points
(
...
...
modules/planning/integration_tests/planning_test_base.h
浏览文件 @
a946e824
...
@@ -35,9 +35,18 @@ namespace planning {
...
@@ -35,9 +35,18 @@ namespace planning {
using
common
::
adapter
::
AdapterManager
;
using
common
::
adapter
::
AdapterManager
;
#define RUN_GOLDEN_TEST \
{ \
const ::testing::TestInfo* const test_info = \
::testing::UnitTest::GetInstance()->current_test_info(); \
bool run_planning_success = RunPlanning(test_info->name(), 0); \
EXPECT_TRUE(run_planning_success); \
}
DECLARE_string
(
test_routing_response_file
);
DECLARE_string
(
test_routing_response_file
);
DECLARE_string
(
test_localization_file
);
DECLARE_string
(
test_localization_file
);
DECLARE_string
(
test_chassis_file
);
DECLARE_string
(
test_chassis_file
);
DECLARE_string
(
test_data_dir
);
DECLARE_string
(
test_prediction_file
);
DECLARE_string
(
test_prediction_file
);
class
PlanningTestBase
:
public
::
testing
::
Test
{
class
PlanningTestBase
:
public
::
testing
::
Test
{
...
@@ -51,7 +60,7 @@ class PlanningTestBase : public ::testing::Test {
...
@@ -51,7 +60,7 @@ class PlanningTestBase : public ::testing::Test {
* @return true if planning is success. The ADCTrajectory will be used to
* @return true if planning is success. The ADCTrajectory will be used to
* store the planing results. Otherwise false.
* store the planing results. Otherwise false.
*/
*/
void
RunPlanning
(
);
bool
RunPlanning
(
const
std
::
string
&
test_case_name
,
int
case_num
);
/**
/**
* @brief Print out the points to a file for debug and visualization purpose.
* @brief Print out the points to a file for debug and visualization purpose.
...
@@ -66,7 +75,9 @@ class PlanningTestBase : public ::testing::Test {
...
@@ -66,7 +75,9 @@ class PlanningTestBase : public ::testing::Test {
const
std
::
string
&
filename
);
const
std
::
string
&
filename
);
protected:
protected:
void
TrimPlanning
(
ADCTrajectory
*
origin
);
bool
SetUpAdapters
();
bool
SetUpAdapters
();
Planning
planning_
;
Planning
planning_
;
ADCTrajectory
*
adc_trajectory_
=
nullptr
;
ADCTrajectory
*
adc_trajectory_
=
nullptr
;
};
};
...
...
modules/planning/optimizer/dp_poly_path/dp_road_graph_test.cc
浏览文件 @
a946e824
...
@@ -66,14 +66,7 @@ class DpRoadGraphTest : public PlanningTestBase {
...
@@ -66,14 +66,7 @@ class DpRoadGraphTest : public PlanningTestBase {
}
}
virtual
void
SetUp
()
{
virtual
void
SetUp
()
{
google
::
InitGoogleLogging
(
"DpRoadGraphTest"
);
FLAGS_test_data_dir
=
"modules/planning/testdata/dp_road_graph_test"
;
PlanningTestBase
::
SetUp
();
RunPlanning
();
SetInitPoint
();
SetSpeedDataWithConstVeolocity
(
10.0
);
const
auto
*
frame
=
planning_
.
GetFrame
();
ASSERT_TRUE
(
frame
!=
nullptr
);
reference_line_
=
&
(
frame
->
reference_line
());
}
}
protected:
protected:
...
@@ -84,6 +77,16 @@ class DpRoadGraphTest : public PlanningTestBase {
...
@@ -84,6 +77,16 @@ class DpRoadGraphTest : public PlanningTestBase {
};
};
TEST_F
(
DpRoadGraphTest
,
speed_road_graph
)
{
TEST_F
(
DpRoadGraphTest
,
speed_road_graph
)
{
PlanningTestBase
::
SetUp
();
RUN_GOLDEN_TEST
;
// specialized tests
SetInitPoint
();
SetSpeedDataWithConstVeolocity
(
10.0
);
const
auto
*
frame
=
planning_
.
GetFrame
();
ASSERT_TRUE
(
frame
!=
nullptr
);
reference_line_
=
&
(
frame
->
reference_line
());
DpPolyPathConfig
dp_poly_path_config
;
// default values
DpPolyPathConfig
dp_poly_path_config
;
// default values
DPRoadGraph
road_graph
(
dp_poly_path_config
,
*
reference_line_
,
speed_data_
);
DPRoadGraph
road_graph
(
dp_poly_path_config
,
*
reference_line_
,
speed_data_
);
ASSERT_TRUE
(
reference_line_
!=
nullptr
);
ASSERT_TRUE
(
reference_line_
!=
nullptr
);
...
...
modules/planning/optimizer/dp_st_speed/dp_st_graph_test.cc
浏览文件 @
a946e824
...
@@ -58,12 +58,7 @@ class DpStSpeedTest : public PlanningTestBase {
...
@@ -58,12 +58,7 @@ class DpStSpeedTest : public PlanningTestBase {
}
}
virtual
void
SetUp
()
{
virtual
void
SetUp
()
{
google
::
InitGoogleLogging
(
"DpStSpeedTest"
);
FLAGS_test_data_dir
=
"modules/planning/testdata/dp_st_speed_test"
;
PlanningTestBase
::
SetUp
();
RunPlanning
();
const
auto
*
frame
=
planning_
.
GetFrame
();
reference_line_
=
&
(
frame
->
reference_line
());
SetPathDataWithStraightLine
();
}
}
protected:
protected:
...
@@ -74,6 +69,9 @@ class DpStSpeedTest : public PlanningTestBase {
...
@@ -74,6 +69,9 @@ class DpStSpeedTest : public PlanningTestBase {
};
};
TEST_F
(
DpStSpeedTest
,
dp_st_graph_test
)
{
TEST_F
(
DpStSpeedTest
,
dp_st_graph_test
)
{
PlanningTestBase
::
SetUp
();
RUN_GOLDEN_TEST
;
DpStSpeedConfig
dp_st_speed_config
;
DpStSpeedConfig
dp_st_speed_config
;
const
auto
&
veh_param
=
const
auto
&
veh_param
=
common
::
VehicleConfigHelper
::
GetConfig
().
vehicle_param
();
common
::
VehicleConfigHelper
::
GetConfig
().
vehicle_param
();
...
...
modules/planning/testdata/dp_road_graph_test/result_speed_road_graph_0.pb.txt
0 → 100755
浏览文件 @
a946e824
此差异已折叠。
点击以展开。
modules/planning/testdata/dp_st_speed_test/result_dp_st_graph_test_0.pb.txt
0 → 100755
浏览文件 @
a946e824
此差异已折叠。
点击以展开。
modules/planning/testdata/garage_test/result_Stop_0.pb.txt
0 → 100755
浏览文件 @
a946e824
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录