forked from Intermodalics/tango_ros
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Intermodalics#64 from Intermodalics/feature/add_un…
…it_test Feature/add unit test
- Loading branch information
Showing
38 changed files
with
1,023 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,4 +44,3 @@ | |
###################### | ||
*OpenCV_sdk_native/ | ||
*roscpp_android_ndk/ | ||
*miniglog/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[submodule "miniglog"] | ||
path = miniglog | ||
url = https://github.com/tzutalin/miniglog | ||
[submodule "third_party/glog_catkin"] | ||
path = third_party/glog_catkin | ||
url = https://github.com/ethz-asl/glog_catkin | ||
[submodule "third_party/catkin_simple"] | ||
path = third_party/catkin_simple | ||
url = https://github.com/catkin/catkin_simple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#! /bin/bash -x | ||
adb root | ||
adb remount | ||
|
||
LIB_DIR="$HOME/tango_apps_ws/src/TangoApps/RosApp/app/src/main/libs/armeabi-v7a" | ||
DEST_DIR="/data/local/tmp" | ||
MASTER_URI="im-desktop-005:11311" | ||
DEVICE_IP="192.168.168.185" | ||
DESKTOP_TEST_DIR="$HOME/tango_apps_ws/devel/lib/tango_ros_native" | ||
|
||
# Push libs and test executable to the device. | ||
adb push $LIB_DIR/libtango_ros_android.so $DEST_DIR/ | ||
adb push $LIB_DIR/libtango_ros_native.so $DEST_DIR/ | ||
adb push $LIB_DIR/libtango_support_api.so $DEST_DIR/ | ||
adb push $LIB_DIR/test_tango_ros_native $DEST_DIR/ | ||
adb shell chmod 775 $DEST_DIR/test_tango_ros_native | ||
|
||
# Start the test on device. | ||
adb shell LD_LIBRARY_PATH=$DEST_DIR $DEST_DIR/test_tango_ros_native __master:=http://$MASTER_URI __ip:=$DEVICE_IP & DEVICE_TEST=&! | ||
|
||
# Sleep some time to be sure that the test on device is running. | ||
sleep 5 | ||
# Start the test on desktop. | ||
$DESKTOP_TEST_DIR/tango_ros_native_test_tango_ros & DESKTOP_TEST=$! | ||
|
||
# Wait till both tests are finished. | ||
wait $DEVICE_TEST | ||
wait $DESKTOP_TEST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2016 Intermodalics All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
#include <time.h> | ||
|
||
#include <gtest/gtest.h> | ||
#include <tango_ros_native/tango_ros_node.h> | ||
#include <tango_ros_native/tango_ros_util.h> | ||
|
||
std::string master_uri; | ||
std::string device_ip; | ||
|
||
class TangoRosTest : public ::testing::Test { | ||
public: | ||
const int TEST_DURATION = 5; // in second. | ||
std::shared_ptr<tango_ros_node::TangoRosNode> tango_ros_node_; | ||
tango_ros_node::PublisherConfiguration publisher_config_; | ||
bool connected_to_tango = false; | ||
|
||
protected: | ||
virtual void SetUp() { | ||
ASSERT_TRUE(tango_ros_util::InitRos(master_uri.c_str(), device_ip.c_str())); | ||
publisher_config_.publish_device_pose = true; | ||
publisher_config_.publish_point_cloud = true; | ||
publisher_config_.publish_camera = tango_ros_node::CAMERA_FISHEYE | tango_ros_node::CAMERA_COLOR; | ||
tango_ros_node_.reset(new tango_ros_node::TangoRosNode(publisher_config_)); | ||
ASSERT_TRUE(tango_ros_node_->OnTangoServiceConnected()); | ||
connected_to_tango = true; | ||
} | ||
|
||
virtual void TearDown() { | ||
if(connected_to_tango) { | ||
tango_ros_node_->TangoDisconnect(); | ||
} | ||
} | ||
}; | ||
|
||
TEST_F(TangoRosTest, TestPublishingForFixedTime) { | ||
time_t current_time = time(NULL); | ||
time_t end = current_time + TEST_DURATION; | ||
while(tango_ros_util::IsRosOK() && current_time < end) { | ||
tango_ros_node_->Publish(); | ||
current_time = time(NULL); | ||
} | ||
} | ||
|
||
// Run all the tests that were declared with TEST() | ||
int main(int argc, char **argv){ | ||
testing::InitGoogleTest(&argc, argv); | ||
master_uri = argv[1]; | ||
device_ip = argv[2]; | ||
return RUN_ALL_TESTS(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
LOCAL_PATH := $(call my-dir) | ||
PROJECT_ROOT:= $(call my-dir)/.. | ||
|
||
include $(CLEAR_VARS) | ||
|
||
OPENCV_INSTALL_MODULES:=on | ||
OPENCV_CAMERA_MODULES:=off | ||
OPENCV_LIB_TYPE:=STATIC | ||
include $(PROJECT_ROOT)/../OpenCV_sdk_native/jni/OpenCV.mk | ||
|
||
LOCAL_MODULE := tango_ros_native | ||
LOCAL_SRC_FILES := $(LOCAL_PATH)/src/tango_ros_node.cpp $(LOCAL_PATH)/src/tango_ros_util.cpp | ||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include | ||
LOCAL_CFLAGS += -g3 -ggdb --std=c++11 -pthread -fPIC -fexceptions -frtti | ||
LOCAL_LDLIBS += -landroid -lm -llog | ||
LOCAL_STATIC_LIBRARIES += roscpp_android_ndk miniglog | ||
LOCAL_SHARED_LIBRARIES := tango_client_api tango_support_api | ||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include | ||
include $(BUILD_SHARED_LIBRARY) | ||
|
||
include $(PROJECT_ROOT)/../miniglog/Android.mk | ||
$(call import-add-path, $(PROJECT_ROOT)/..) | ||
$(call import-module,roscpp_android_ndk) | ||
$(call import-add-path, $(PROJECT_ROOT)/../tango_api) | ||
$(call import-module,tango_client_api) | ||
$(call import-module,tango_support_api) |
Oops, something went wrong.