mirror of
https://github.com/ttroy50/cmake-examples.git
synced 2025-12-18 20:24:35 +03:00
add tests for all examples #4
This commit is contained in:
@@ -3,9 +3,9 @@ sudo: required
|
||||
compiler:
|
||||
- gcc
|
||||
before_install:
|
||||
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update && sudo apt-get install -y cmake protobuf-compiler cppcheck; fi
|
||||
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update && sudo apt-get install -y cmake libboost-all-dev libprotobuf-dev protobuf-compiler cppcheck; fi
|
||||
script:
|
||||
- cd 01-basic/A-hello-cmake && mkdir build && cd build && cmake .. && make
|
||||
- test.sh
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
35
test.sh
Executable file
35
test.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
dirs=( ./01-basic/A-hello-cmake \
|
||||
./01-basic/B-hello-headers \
|
||||
./01-basic/C-static-library \
|
||||
./01-basic/D-shared-library \
|
||||
./01-basic/E-installing \
|
||||
./01-basic/F-build-type \
|
||||
./01-basic/G-compile-flags \
|
||||
./01-basic/H-third-party-library \
|
||||
./02-sub-projects/A-basic \
|
||||
./03-code-generation/protobuf \
|
||||
./03-code-generation/configure-files \
|
||||
./04-static-analysis/cppcheck \
|
||||
)
|
||||
|
||||
ROOT_DIR=`pwd`
|
||||
|
||||
for dir in ${dirs[*]}
|
||||
do
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Running test for $dir"
|
||||
cd $ROOT_DIR
|
||||
if [ -d "$dir/build" ]; then
|
||||
echo "deleting $dir/build"
|
||||
rm -r $dir/build
|
||||
fi
|
||||
|
||||
cd $dir && mkdir -p build && cd build && cmake .. && make
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error running example $dir"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user