mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 12:56:26 +00:00
Generate test coverage and use Coveralls for tracking and visualization (#1366)
* Add code-coverage make target and github actions workflow * Upload coverage to coveralls * Add coverage badge to readme * Fix some test makefiles to correctly propagate flags
This commit is contained in:
parent
1da5092ac8
commit
900f7b18be
69
.github/workflows/code_coverage.yml
vendored
Normal file
69
.github/workflows/code_coverage.yml
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
name: Code Coverage
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- '.github/workflows/**'
|
||||
- '!.github/workflows/code_coverage.yml'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
code-coverage:
|
||||
runs-on: ubuntu-latest
|
||||
container: docker://oraclelinux:8
|
||||
steps:
|
||||
- name: Update Package Manager
|
||||
run: |
|
||||
dnf -y install epel-release
|
||||
dnf -y update
|
||||
dnf install -y 'dnf-command(config-manager)'
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
dnf install -y bison clang flex git llvm make maven cmake zip clang-devel gcc gcc-c++ java-11-openjdk-devel libxml2-devel llvm-devel llvm-static ncurses-devel openmotif openmotif-devel perl perl-Digest-MD5 udunits2 udunits2-devel which zlib-devel python2-devel python3-devel swig diffutils lcov
|
||||
|
||||
- name: Install GTest
|
||||
run: |
|
||||
dnf config-manager --enable ol8_codeready_builder
|
||||
dnf install -y gtest-devel
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Configure Trick
|
||||
run: |
|
||||
export MAKEFLAGS=-j`nproc`
|
||||
export PYTHON_VERSION=3
|
||||
./configure
|
||||
- name: Build Trick
|
||||
run: |
|
||||
export MAKEFLAGS=-j`nproc`
|
||||
export CFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export CXXFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export LDFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export TRICK_CFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export TRICK_CXXFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export TRICK_SYSTEM_LDFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export TRICK_SYSTEM_CFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export TRICK_SYSTEM_CXXFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
make
|
||||
- name: Generate Code Coverage
|
||||
run: |
|
||||
export MAKEFLAGS=-j`nproc`
|
||||
export CFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export CXXFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export LDFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export TRICK_CFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export TRICK_CXXFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export TRICK_SYSTEM_LDFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export TRICK_SYSTEM_CFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
export TRICK_SYSTEM_CXXFLAGS="-fprofile-arcs -ftest-coverage -O0"
|
||||
make code-coverage
|
||||
- name: Upload to Coveralls
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
path-to-lcov: "./coverage.info"
|
5
Makefile
5
Makefile
@ -307,6 +307,11 @@ sim_test:
|
||||
pytest:
|
||||
make -C share/trick/pymods/trick
|
||||
|
||||
code-coverage: test
|
||||
lcov --capture --directory trick_source/sim_services --output-file coverage_large.info
|
||||
lcov --remove coverage_large.info '/Library/*' '/usr/*' '*/io_src/*' '*/test/*' -o coverage.info
|
||||
rm coverage_large.info
|
||||
lcov --list coverage.info
|
||||
|
||||
#requirements:
|
||||
# @ $(MAKE) -C trick_test/requirements_docs install
|
||||
|
10
README.md
10
README.md
@ -8,20 +8,18 @@
|
||||
<a href="https://github.com/nasa/trick/actions?query=workflow%3ALinux">
|
||||
<img src="https://github.com/nasa/trick/workflows/Linux/badge.svg?branch=master" alt="Linux" height=30px>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align=left>
|
||||
<a href="https://github.com/nasa/trick/actions?query=workflow%3AmacOS">
|
||||
<img src="https://github.com/nasa/trick/workflows/macOS/badge.svg?branch=master" alt="macOS" height=30px>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align=left>
|
||||
<a href="https://github.com/nasa/trick/actions?query=workflow%3A32-bit">
|
||||
<img src="https://github.com/nasa/trick/workflows/32-bit/badge.svg?branch=master" alt="macOS" height=30px>
|
||||
</a>
|
||||
<a href="https://coveralls.io/github/nasa/trick?branch=master">
|
||||
<img src="https://coveralls.io/repos/github/nasa/trick/badge.svg?branch=master" alt="Coverage Status" height=30px>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
|
||||
<p align=justify>
|
||||
The Trick Simulation Environment, developed at the NASA Johnson Space Center, is a powerful simulation development framework that enables users to build applications for all phases of space vehicle development. Trick expedites the creation of simulations for early vehicle design, performance evaluation, flight software development, flight vehicle dynamic load analysis, and virtual/hardware in the loop training. Trick's purpose is to provide a common set of simulation capabilities that allow users to concentrate on their domain specific models, rather than simulation-specific functions like job ordering, input file processing, or data recording.
|
||||
</p>
|
||||
|
@ -24,7 +24,7 @@ endif
|
||||
SHARED_LIB_OPT := -shared
|
||||
RPATH = -Wl,-rpath=${TRICK_LIB_DIR}
|
||||
|
||||
TRICK_SYSTEM_LDFLAGS = -Wl,--export-dynamic
|
||||
TRICK_SYSTEM_LDFLAGS += -Wl,--export-dynamic
|
||||
PLATFORM_LIBS = -lrt
|
||||
|
||||
LD_WHOLE_ARCHIVE := -Wl,-whole-archive
|
||||
|
2
trick_source/.gitignore
vendored
2
trick_source/.gitignore
vendored
@ -0,0 +1,2 @@
|
||||
*.gcda
|
||||
*.gcno
|
@ -8,7 +8,7 @@
|
||||
include $(dir $(lastword $(MAKEFILE_LIST)))../../../../share/trick/makefiles/Makefile.common
|
||||
|
||||
# Flags passed to the preprocessor.
|
||||
TRICK_CPPFLAGS += -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -g -Wall -Wextra -std=c++11 ${TRICK_SYSTEM_CXXFLAGS}
|
||||
TRICK_CXXFLAGS += -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -g -Wall -Wextra -std=c++11 ${TRICK_SYSTEM_CXXFLAGS}
|
||||
|
||||
LIBS = -L${GTEST_HOME}/lib64 -L${GTEST_HOME}/lib -lgtest -lgtest_main
|
||||
|
||||
@ -38,10 +38,10 @@ clean :
|
||||
rm -f $(TESTS) *.o
|
||||
|
||||
GetTimeOfDayClock_test.o : GetTimeOfDayClock_test.cpp
|
||||
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
|
||||
$(TRICK_CXX) $(TRICK_CXXFLAGS) -c $<
|
||||
|
||||
GetTimeOfDayClock_test : ${GETTIMEOFDAY_CLOCK_OBJECTS}
|
||||
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ ${LIBS}
|
||||
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) $(TRICK_CXXFLAGS) -o $@ $^ ${LIBS}
|
||||
|
||||
exec_get_rt_nap_stub.o : exec_get_rt_nap_stub.cpp
|
||||
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
|
||||
$(TRICK_CXX) $(TRICK_CXXFLAGS) -c $<
|
||||
|
@ -8,7 +8,7 @@
|
||||
include $(dir $(lastword $(MAKEFILE_LIST)))../../../../share/trick/makefiles/Makefile.common
|
||||
|
||||
# Flags passed to the preprocessor.
|
||||
TRICK_CPPFLAGS += -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -g -Wall -Wextra -std=c++11 ${TRICK_SYSTEM_CXXFLAGS}
|
||||
TRICK_CXXFLAGS += -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -g -Wall -Wextra -std=c++11 ${TRICK_SYSTEM_CXXFLAGS}
|
||||
|
||||
TRICK_LIBS = -L ${TRICK_LIB_DIR} -ltrick_mm -ltrick_units -ltrick
|
||||
TRICK_EXEC_LINK_LIBS += -L${GTEST_HOME}/lib64 -L${GTEST_HOME}/lib -lgtest -lgtest_main
|
||||
@ -31,7 +31,7 @@ clean :
|
||||
rm -f $(TESTS) *.o
|
||||
|
||||
Executive_test.o : Executive_test.cpp
|
||||
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
|
||||
$(TRICK_CXX) $(TRICK_CXXFLAGS) -c $<
|
||||
|
||||
Executive_test : Executive_test.o
|
||||
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) $(TRICK_LIBS) $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
|
||||
|
@ -10,8 +10,8 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../../share/trick/makefiles/Mak
|
||||
# Replace -isystem with -I so ICG doesn't skip Trick headers
|
||||
TRICK_SYSTEM_CXXFLAGS := $(subst -isystem,-I,$(TRICK_SYSTEM_CXXFLAGS))
|
||||
|
||||
#COVERAGE_FLAGS += -fprofile-arcs -ftest-coverage -O0
|
||||
#TRICK_SYSTEM_LDFLAGS += ${COVERAGE_FLAGS}
|
||||
COVERAGE_FLAGS += -fprofile-arcs -ftest-coverage -O0
|
||||
TRICK_SYSTEM_LDFLAGS += ${COVERAGE_FLAGS}
|
||||
|
||||
# Flags passed to the preprocessor.
|
||||
TRICK_CPPFLAGS += -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -g -Wall -Wextra -Wno-sign-compare ${COVERAGE_FLAGS} -std=c++11 ${TRICK_SYSTEM_CXXFLAGS}
|
||||
|
@ -8,7 +8,7 @@
|
||||
include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
|
||||
|
||||
# Flags passed to the preprocessor.
|
||||
TRICK_CPPFLAGS += -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -g -Wall -Wextra -std=c++11 ${TRICK_SYSTEM_CXXFLAGS}
|
||||
TRICK_CXXFLAGS += -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -g -Wall -Wextra -std=c++11 ${TRICK_SYSTEM_CXXFLAGS}
|
||||
|
||||
TRICK_LIBS = ${TRICK_LIB_DIR}/libtrick.a
|
||||
TRICK_EXEC_LINK_LIBS += -L${GTEST_HOME}/lib64 -L${GTEST_HOME}/lib -lgtest -lgtest_main -lpthread
|
||||
@ -34,8 +34,8 @@ clean :
|
||||
rm -rf io_src xml
|
||||
|
||||
Interpolator_unittest.o : Interpolator_unittest.cc
|
||||
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
|
||||
$(TRICK_CXX) $(TRICK_CXXFLAGS) -c $<
|
||||
|
||||
Interpolator_unittest : Interpolator_unittest.o
|
||||
$(TRICK_CXX) $(TRICK_CPPFLAGS) -o $@ $^ $(OTHER_OBJECTS) -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
|
||||
$(TRICK_CXX) $(TRICK_CXXFLAGS) -o $@ $^ $(OTHER_OBJECTS) -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
|
||||
|
||||
# Flags passed to the preprocessor.
|
||||
TRICK_CPPFLAGS += -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -g -Wall -Wextra -std=c++11 ${TRICK_SYSTEM_CXXFLAGS}
|
||||
TRICK_CXXFLAGS += -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -g -Wall -Wextra -std=c++11 ${TRICK_SYSTEM_CXXFLAGS}
|
||||
|
||||
TRICK_LIBS = ${TRICK_LIB_DIR}/libtrick.a
|
||||
TRICK_EXEC_LINK_LIBS += -L${GTEST_HOME}/lib64 -L${GTEST_HOME}/lib -lgtest -lpthread
|
||||
@ -34,8 +34,8 @@ clean :
|
||||
rm -rf io_src xml
|
||||
|
||||
unicode_utils_test.o : unicode_utils_test.cpp
|
||||
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
|
||||
$(TRICK_CXX) $(TRICK_CXXFLAGS) -c $<
|
||||
|
||||
unicode_utils_test : unicode_utils_test.o
|
||||
$(TRICK_CXX) $(TRICK_CPPFLAGS) -o $@ $^ $(OTHER_OBJECTS) -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
|
||||
$(TRICK_CXX) $(TRICK_CXXFLAGS) -o $@ $^ $(OTHER_OBJECTS) -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user