Skip to content

Commit d910a17

Browse files
author
CI script
committed
Split tests to individual files
1 parent 637607e commit d910a17

File tree

4 files changed

+69
-49
lines changed

4 files changed

+69
-49
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash -e
2+
3+
cat << EOF > CMakeLists.txt
4+
cmake_minimum_required(VERSION 3.10)
5+
project(subdir_test)
6+
add_subdirectory(subdir)
7+
EOF
8+
9+
mkdir subdir && cd "$_"
10+
git init
11+
cppsm init-hello
12+
13+
mkdir ../.build && cd "$_"
14+
cmake ..
15+
cmake --build .
16+
17+
if [ -n "$(find . -name "message_test*")" ]; then exit 1; fi
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash -e
2+
3+
git init
4+
cppsm init-hello
5+
6+
git commit -m Initial
7+
8+
git submodule --quiet add -b v1 https://github.com/per-framework/dumpster.cpp.git equipment/dumpster.cpp/v1
9+
cppsm add equipment https://github.com/per-framework/dumpster.cpp.git v1
10+
cppsm add requires https://github.com/per-framework/dumpster.cpp.git v1
11+
cppsm add equipment https://github.com/per-framework/dumpster.cpp.git v1
12+
13+
cppsm list
14+
15+
cppsm remove requires/polyfill.cpp/v1
16+
17+
if cppsm list; then
18+
exit 1
19+
fi

.cppsm/testing/init_library_test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash -e
2+
3+
git init
4+
cppsm init-library
5+
CXX='' CC='' cppsm test

.cppsm/travis-ci

Lines changed: 28 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -11,58 +11,37 @@ git config --global core.autocrlf false
1111
git config --global user.email "[email protected]"
1212
git config --global user.name "CI script"
1313

14-
# init-library
15-
16-
mkdir library && cd "$_"
17-
18-
git init
19-
cppsm init-library
20-
CXX='' CC='' cppsm test
21-
22-
cd ..
23-
24-
# add_subdirectory test
25-
26-
mkdir -p subdir/hello && cd "$_"
27-
28-
git init
29-
cppsm init-hello
30-
31-
cd ..
32-
cat << EOF > CMakeLists.txt
33-
cmake_minimum_required(VERSION 3.10)
34-
project(subdir_test)
35-
add_subdirectory(hello)
36-
EOF
37-
38-
mkdir .build && cd "$_"
39-
cmake ..
40-
cmake --build .
41-
42-
if [ -n "$(find . -name "message_test*")" ]; then exit 1; fi
43-
44-
cd ../..
45-
46-
# self test
47-
48-
mkdir hello && cd "$_"
14+
# Run tests
15+
16+
folded() {
17+
FOLD=$((FOLD+1))
18+
echo -e "travis_fold:start:cppsm.$FOLD\033[33;1m$1\033[0m"
19+
travis_time_start
20+
shift
21+
echo "$@"
22+
"$@"
23+
travis_time_finish
24+
echo -e "\ntravis_fold:end:cppsm.$FOLD\r"
25+
}
26+
27+
run-test() {
28+
mkdir "$NAME"
29+
pushd "$NAME" > /dev/null
30+
"../$TEST"
31+
popd
32+
}
33+
34+
for TEST in .cppsm/testing/* ; do
35+
NAME="${TEST##*/}"
36+
folded "$NAME" run-test
37+
done
38+
39+
# Test travis-ci script
40+
41+
mkdir travis_ci_test && cd "$_"
4942

5043
git init
5144
cppsm init-hello
52-
5345
git commit -m Initial
5446

5547
../travis-ci
56-
57-
git submodule --quiet add -b v1 https://github.com/per-framework/dumpster.cpp.git equipment/dumpster.cpp/v1
58-
cppsm add equipment https://github.com/per-framework/dumpster.cpp.git v1
59-
cppsm add requires https://github.com/per-framework/dumpster.cpp.git v1
60-
cppsm add equipment https://github.com/per-framework/dumpster.cpp.git v1
61-
62-
cppsm list
63-
64-
cppsm remove requires/polyfill.cpp/v1
65-
66-
if cppsm list; then
67-
exit 1
68-
fi

0 commit comments

Comments
 (0)