Browse Source

CPP: Fix bug in installation step and add test to the continuous integration script.

pull/567/head
Philippe Liard 15 years ago
committed by Mihaela Rosca
parent
commit
33a02e4e4f
2 changed files with 33 additions and 4 deletions
  1. +3
    -1
      cpp/CMakeLists.txt
  2. +30
    -3
      tools/script/continuous-integration.sh

+ 3
- 1
cpp/CMakeLists.txt View File

@ -313,10 +313,12 @@ install (FILES
install (FILES install (FILES
"src/base/basictypes.h" "src/base/basictypes.h"
"src/base/memory/singleton.h"
"src/base/scoped_ptr.h" "src/base/scoped_ptr.h"
DESTINATION include/base/ DESTINATION include/base/
) )
install (FILES src/base/memory/singleton.h
DESTINATION include/base/memory)
install (FILES src/base/synchronization/lock.h install (FILES src/base/synchronization/lock.h
DESTINATION include/base/synchronization) DESTINATION include/base/synchronization)


+ 30
- 3
tools/script/continuous-integration.sh View File

@ -23,12 +23,39 @@
(find resources/geocoding -type f | xargs file | egrep -v 'UTF-8|ASCII') && exit 1 (find resources/geocoding -type f | xargs file | egrep -v 'UTF-8|ASCII') && exit 1
# Test the C++ version with the provided CMake parameter. # Test the C++ version with the provided CMake parameter.
CXX=g++
INSTALL_PREFIX=/tmp/libphonenumber
test_cpp_version() { test_cpp_version() {
CC_TEST_FILE=`mktemp`.cc
CC_TEST_BINARY=`mktemp`
CMAKE_FLAGS="$1" CMAKE_FLAGS="$1"
# Write the program that tests the installation of the library to a temporary
# source file.
> $CC_TEST_FILE echo '
#include <cassert>
#include <phonenumbers/phonenumberutil.h>
using i18n::phonenumbers::PhoneNumberUtil;
int main() {
PhoneNumberUtil* const phone_util = PhoneNumberUtil::GetInstance();
return phone_util == NULL;
}'
# Run the build and tests.
( (
rm -rf cpp/build && mkdir cpp/build && cd cpp/build && \
cmake "${CMAKE_FLAGS}" .. && make && ./libphonenumber_test
) || exit $?
rm -rf cpp/build /tmp/libphonenumber &&
mkdir cpp/build /tmp/libphonenumber && cd cpp/build &&
cmake "${CMAKE_FLAGS}" -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX .. &&
make && ./libphonenumber_test && make install &&
$CXX -o $CC_TEST_BINARY $CC_TEST_FILE -I${INSTALL_PREFIX}/include \
-lboost_thread -L${INSTALL_PREFIX}/lib -lphonenumber &&
$CC_TEST_BINARY
)
STATUS=$?
# Remove the temporary files.
rm -f $CC_TEST_FILE
rm -f $CC_TEST_BINARY
[ $STATUS -ne 0 ] && exit $STATUS
} }
test_cpp_version '' test_cpp_version ''
test_cpp_version '-DUSE_RE2=ON' test_cpp_version '-DUSE_RE2=ON'


Loading…
Cancel
Save