Skip to content

Commit 4097894

Browse files
committed
[jsk_tools] Add test_env_hooks.test.
1 parent df29bfb commit 4097894

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

jsk_tools/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ if (CATKIN_ENABLE_TESTING)
5252
jsk_tools_add_rostest(test/test_stdout.test)
5353
jsk_tools_add_rostest(test/test_rostopic_host_sanity.test)
5454
jsk_tools_add_rostest(test/test_sanity_diagnostics.test)
55+
jsk_tools_add_rostest(test/test_env_hooks.test)
5556
find_package(jsk_tools REQUIRED)
5657
jsk_tools_add_shell_test(COMMAND echo "testing jsk_tools_add_shell_test")
5758
endif()

jsk_tools/test/sh/rossetip.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
JSK_TOOLS_PATH=$(rospack find jsk_tools)
4+
if [ "$JSK_TOOLS_PATH" = "/opt/ros/${ROS_DISTRO}/share/jsk_tools" ]; then
5+
source /opt/ros/${ROS_DISTRO}/setup.bash
6+
else
7+
source `catkin locate --shell-verbs`
8+
if [ "$(rospack find jsk_tools)" = "$(catkin locate --install)/share/jsk_tools" ]; then
9+
# for install
10+
source "$(rospack find jsk_tools)"/catkin_env_hook/99.jsk_tools.sh
11+
else
12+
# for devel
13+
cd "$JSK_TOOLS_PATH" && source `catkin locate --devel`/etc/catkin/profile.d/99.jsk_tools.sh
14+
fi
15+
fi
16+
17+
18+
ECHO_OUTPUT="$1"
19+
function ip() {
20+
echo "$ECHO_OUTPUT"
21+
}
22+
rossetip > /dev/null 2>&1
23+
echo $ROS_IP

jsk_tools/test/sh/rossetmaster.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
JSK_TOOLS_PATH=$(rospack find jsk_tools)
4+
if [ "$JSK_TOOLS_PATH" = "/opt/ros/${ROS_DISTRO}/share/jsk_tools" ]; then
5+
source /opt/ros/${ROS_DISTRO}/setup.bash
6+
else
7+
source `catkin locate --shell-verbs`
8+
if [ "$(rospack find jsk_tools)" = "$(catkin locate --install)/share/jsk_tools" ]; then
9+
# for install
10+
source "$(rospack find jsk_tools)"/catkin_env_hook/99.jsk_tools.sh
11+
else
12+
# for devel
13+
cd "$JSK_TOOLS_PATH" && source `catkin locate --devel`/etc/catkin/profile.d/99.jsk_tools.sh
14+
fi
15+
fi
16+
17+
rossetmaster "$1" "${2-11311}" > /dev/null 2>&1
18+
echo $ROS_MASTER_URI

jsk_tools/test/test_env_hooks.test

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<launch>
2+
3+
<test test-name="test_rossetip0"
4+
name="test_rossetip0"
5+
pkg="jsk_tools" type="test_stdout.py">
6+
<!-- testing https://github.com/jsk-ros-pkg/jsk_common/issues/1472 -->
7+
<param name="~command" value="/bin/bash $(find jsk_tools)/test/sh/rossetip.sh
8+
&quot;2: eth33 inet 133.11.216.88/24 brd 133.11.216.255 scope global eth33&quot;" />
9+
<param name="stdout" value="133.11.216.88" />
10+
</test>
11+
12+
<test test-name="test_rossetip1"
13+
name="test_rossetip1"
14+
pkg="jsk_tools" type="test_stdout.py">
15+
<!-- testing https://github.com/jsk-ros-pkg/jsk_common/issues/1472 -->
16+
<param name="~command" value="/bin/bash $(find jsk_tools)/test/sh/rossetip.sh
17+
&quot;2: lo inet 192.168.96.20/24 brd 192.168.102.255 scope global&quot;" />
18+
<param name="stdout" value="192.168.96.20" />
19+
</test>
20+
21+
<test test-name="test_rossetmaster0"
22+
name="test_rossetmaster0"
23+
pkg="jsk_tools" type="test_stdout.py">
24+
<param name="~command" value="/bin/bash $(find jsk_tools)/test/sh/rossetmaster.sh localhost" />
25+
<param name="stdout" value="http://localhost:11311" />
26+
</test>
27+
28+
<test test-name="test_rossetmaster1"
29+
name="test_rossetmaster1"
30+
pkg="jsk_tools" type="test_stdout.py">
31+
<param name="~command" value="/bin/bash $(find jsk_tools)/test/sh/rossetmaster.sh hrp2017v 10017" />
32+
<param name="stdout" value="http://hrp2017v:10017" />
33+
</test>
34+
35+
</launch>

0 commit comments

Comments
 (0)