-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUILD/TEST] Formalize tests, project structure (#14)
* [BUILD/TEST] Formalize tests, project structure * update cmake to reflect version
- Loading branch information
Showing
14 changed files
with
161 additions
and
26 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 |
---|---|---|
|
@@ -29,4 +29,4 @@ | |
*.app | ||
*~ | ||
build | ||
mock | ||
bin |
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,46 @@ | ||
sudo: false | ||
|
||
dist: trusty | ||
|
||
language: cpp | ||
|
||
os: | ||
- linux | ||
- osx | ||
|
||
osx_image: xcode8 | ||
|
||
env: | ||
# code analysis | ||
- TASK=all_test | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
matrix: | ||
exclude: | ||
- os: osx | ||
env: TASK=lint | ||
|
||
# dependent apt packages | ||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- doxygen | ||
- wget | ||
- graphviz | ||
- unzip | ||
|
||
install: | ||
- source tests/travis/setup.sh | ||
|
||
script: | ||
- tests/travis/run_test.sh | ||
|
||
cache: | ||
directories: | ||
- ${HOME}/.cache/usr | ||
|
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 |
---|---|---|
@@ -1,24 +1,35 @@ | ||
.PHONY: clean all test doc | ||
.PHONY: clean all test doc lint | ||
|
||
all: mock | ||
all: bin/mock | ||
|
||
LDFLAGS = | ||
CFLAGS = -std=c++11 -Wall -O3 -Iinclude | ||
CFLAGS = -Wall -O3 -Iinclude -Icontrib | ||
CXXFLAGS = -std=c++11 $(CFLAGS) | ||
|
||
SRC = $(wildcard src/*.cc src/*/*.cc src/*/*/*.cc) | ||
ALL_OBJ = $(patsubst src/%.cc, build/%.o, $(SRC)) | ||
SRC = $(wildcard contrib/*.cc contrib/*.c) | ||
ALL_CXX_OBJ = $(patsubst contrib/%.cc, build/%.o, $(SRC)) | ||
ALL_C_OBJ = $(patsubst contrib/%.c, build/%.o, $(SRC)) | ||
ALL_OBJ = $(ALL_CC_OBJ) $(ALL_CXX_OBJ) | ||
|
||
doc: | ||
doxygen docs/Doxyfile | ||
|
||
build/%.o: src/%.cc | ||
lint: | ||
./tests/scripts/task_lint.sh | ||
|
||
build/%.o: contrib/%.cc | ||
@mkdir -p $(@D) | ||
$(CXX) $(CXXFLAGS) -MM -MT build/$*.o $< >build/$*.d | ||
$(CXX) -c $(CXXFLAGS) -c $< -o $@ | ||
|
||
build/%.o: contrib/%.c | ||
@mkdir -p $(@D) | ||
$(CXX) $(CFLAGS) -MM -MT build/$*.o $< >build/$*.d | ||
$(CXX) -c $(CFLAGS) -c $< -o $@ | ||
$(CC) $(CFLAGS) -MM -MT build/$*.o $< >build/$*.d | ||
$(CC) -c $(CFLAGS) -c $< -o $@ | ||
|
||
mock: $(ALL_OBJ) | ||
bin/mock: $(ALL_OBJ) | ||
@mkdir -p $(@D) | ||
$(CXX) $(CFLAGS) -o $@ $(filter %.o %.a, $^) $(LDFLAGS) | ||
$(CXX) $(CXXFLAGS) -o $@ $(filter %.o %.a, $^) $(LDFLAGS) | ||
|
||
clean: | ||
$(RM) -rf build */*/*/*~ */*.o */*/*.o */*/*/*.o */*.d */*/*.d */*/*/*.d |
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,7 @@ | ||
DLPack Change Log | ||
================= | ||
|
||
This file records the changes in DLPack in reverse chronological order. | ||
|
||
## v0.1 | ||
- Finalize DLTensor structure |
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
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,7 @@ | ||
// Copyright by contributors | ||
// This file is used to make sure the package is C compatible | ||
#include <dlpack/dlpack.h> | ||
|
||
int GetNDim(DLTensor *t) { | ||
return t->ndim; | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// Copyright by contributors | ||
#include <dlpack/dlpack.h> | ||
#include <dlpack/dlpackcpp.h> | ||
|
||
|
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,6 @@ | ||
#!/bin/bash | ||
make || exit -1 | ||
mkdir -p build | ||
cd build | ||
cmake .. || exit -1 | ||
make || exit -1 |
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,23 @@ | ||
#!/bin/bash | ||
mkdir -p bin | ||
|
||
if [ ! -f bin/lint.py ]; then | ||
echo "Grab linter ..." | ||
wget https://raw.githubusercontent.com/dmlc/dmlc-core/master/scripts/lint.py | ||
mv lint.py bin/lint.py | ||
fi | ||
|
||
echo "Check codestyle of c++ code..." | ||
python bin/lint.py dlpack cpp include contrib | ||
|
||
echo "Check doxygen generation..." | ||
make doc 2>log.txt | ||
(cat log.txt| grep -v ENABLE_PREPROCESSING |grep -v "unsupported tag") > logclean.txt | ||
echo "---------Error Log----------" | ||
cat logclean.txt | ||
echo "----------------------------" | ||
(cat logclean.txt|grep warning) && exit -1 | ||
(cat logclean.txt|grep error) && exit -1 | ||
rm logclean.txt | ||
rm log.txt | ||
echo "All checks passed..." |
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,12 @@ | ||
#!/bin/bash | ||
if [ ${TASK} == "lint" ] || [ ${TASK} == "all_test" ]; then | ||
if [ ! ${TRAVIS_OS_NAME} == "osx" ]; then | ||
./tests/scripts/task_lint.sh || exit -1 | ||
fi | ||
fi | ||
|
||
if [ ${TASK} == "build" ] || [ ${TASK} == "all_test" ]; then | ||
./tests/scripts/task_build.sh || exit -1 | ||
fi | ||
|
||
echo "All travis test passed.." |
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,5 @@ | ||
if [ ${TASK} == "lint" ] || [ ${TASK} == "all_test" ]; then | ||
if [ ! ${TRAVIS_OS_NAME} == "osx" ]; then | ||
pip install --user cpplint | ||
fi | ||
fi |