Merge branch '219-add-code-coverage' into 'master'

Resolve "Add Code Coverage"

Closes #219

See merge request ems/astdm/dram.sys!228
This commit is contained in:
Matthias Jung
2019-02-08 11:44:06 +01:00
6 changed files with 78 additions and 7 deletions

View File

@@ -7,10 +7,7 @@ stages:
- build
- WIDEIO
- DDR3
cache:
paths:
- build/
- Coverage
build:
stage: build
@@ -22,7 +19,27 @@ build:
- cd build
- qmake ../DRAMSys/DRAMSys.pro
- make -j4
- find . -name "*.o" -type f -delete
cache:
key: build
paths:
- build/
policy: push
coverage:
stage: Coverage
coverage: '/Total:\|(\d+\.?\d+\%)/'
script:
# delete all empty files since they produce errors
- find coverage -size 0 -type f -delete
- ls coverage/ -lah
- lcov `find coverage -type f -exec echo "-a {}" \;` -o coverage/final.out
- lcov --list coverage/final.out
artifacts:
paths:
- coverage/final.out
include:
- '/DRAMSys/tests/DDR3/ci.yml'
- '/DRAMSys/tests/WIDEIO/ci.yml'

View File

@@ -58,11 +58,15 @@ DEFINES += SC_INCLUDE_DYNAMIC_PROCESSES
unix:!macx {
QMAKE_CXXFLAGS += -std=c++11 -O0 -g
QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage -fPIC -O0
QMAKE_LFLAGS += -lgcov --coverage
}
macx: {
CONFIG += c++11
QMAKE_CXXFLAGS += -std=c++0x -stdlib=libc++ -O0 -g
QMAKE_CXXFLAGS += --coverage
QMAKE_LFLAGS += --coverage
}
QMAKE_CXXFLAGS += -isystem $${systemc_home}/include

View File

@@ -29,11 +29,15 @@ DEFINES += SC_INCLUDE_DYNAMIC_PROCESSES
unix:!macx {
QMAKE_CXXFLAGS += -std=c++11 -O0 -g
QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage -fPIC -O0
QMAKE_LFLAGS += -lgcov --coverage
}
macx: {
CONFIG += c++11
QMAKE_CXXFLAGS += -std=c++0x -stdlib=libc++ -O0 -g
QMAKE_CXXFLAGS += --coverage
QMAKE_LFLAGS += --coverage
}
INCLUDEPATH += ../library/src/simulation/

View File

@@ -10,9 +10,20 @@ example_ddr3:
- perl -e 'if(`sqldiff ../../DRAMSys/tests/DDR3/expected/ddr3-example_ddr3_ch0.tdb ddr3-example_ddr3_ch0.tdb` eq "") {exit(0)} else {exit(-1)}'
- cd ../traceAnalyzer
- python3 ../../DRAMSys/traceAnalyzer/scripts/tests.py ../simulator/ddr3-example_ddr3_ch0.tdb | if ! grep "failed"; then exit 0; else exit 1; fi
# Run Code Coverage
- mkdir -p ${CI_PROJECT_DIR}/coverage
- lcov -q -c -d ${CI_PROJECT_DIR}/build/ -o ${CI_PROJECT_DIR}/coverage/${CI_JOB_NAME}.out
cache:
key: build
paths:
- build/
policy: pull
artifacts:
paths:
- build/simulator/ddr3-example_ddr3_ch0.tdb
- coverage/${CI_JOB_NAME}.out
expire_in: 2 days
# Testing Reordering with FR_FCFS Scheduling Algorithm:
@@ -27,12 +38,22 @@ fr_fcfs:
- perl -e 'if(`sqldiff ../../DRAMSys/tests/DDR3/expected/ddr3-fr_fcfs_ddr3_ch0.tdb ddr3-fr_fcfs_ddr3_ch0.tdb` eq "") {exit(0)} else {exit(-1)}'
- cd ../traceAnalyzer
- python3 ../../DRAMSys/traceAnalyzer/scripts/tests.py ../simulator/ddr3-fr_fcfs_ddr3_ch0.tdb | if ! grep "failed"; then exit 0; else exit 1; fi
# Run Code Coverage
- mkdir -p ${CI_PROJECT_DIR}/coverage
- lcov -q -c -d ${CI_PROJECT_DIR}/build/ -o ${CI_PROJECT_DIR}/coverage/${CI_JOB_NAME}.out
cache:
key: build
paths:
- build/
policy: pull
allow_failure: true # TODO should be removed after first tests
artifacts:
paths:
- build/simulator/ddr3-fr_fcfs_ddr3_ch0.tdb
- coverage/${CI_JOB_NAME}.out
expire_in: 2 days
# Testing with TLM Protocol Cchecker
@@ -40,5 +61,20 @@ protocol_checker:
stage: DDR3
script:
- cd build/simulator
- ./DRAMSys ../../DRAMSys/tests/DDR3/simulations/ddr3-protocol_checker.xml ../../DRAMSys/tests/DDR3/
- ./DRAMSys ../../DRAMSys/tests/DDR3/simulations/ddr3-protocol_checker.xml ../../DRAMSys/tests/DDR3/ > output.txt
- echo "TODO"
- ls -lah
# Run Code Coverage
- mkdir -p ${CI_PROJECT_DIR}/coverage
- lcov -q -c -d ${CI_PROJECT_DIR}/build/ -o ${CI_PROJECT_DIR}/coverage/${CI_JOB_NAME}.out
cache:
key: build
paths:
- build/
policy: pull
artifacts:
paths:
- coverage/${CI_JOB_NAME}.out
expire_in: 2 days

View File

@@ -15,7 +15,16 @@ example_wideio:
- python3 ../../DRAMSys/traceAnalyzer/scripts/tests.py ../simulator/wideio-example_wideio_ch1.tdb | if ! grep "failed"; then exit 0; else exit 1; fi
- python3 ../../DRAMSys/traceAnalyzer/scripts/tests.py ../simulator/wideio-example_wideio_ch2.tdb | if ! grep "failed"; then exit 0; else exit 1; fi
- python3 ../../DRAMSys/traceAnalyzer/scripts/tests.py ../simulator/wideio-example_wideio_ch3.tdb | if ! grep "failed"; then exit 0; else exit 1; fi
# Run Code Coverage
- mkdir -p ${CI_PROJECT_DIR}/coverage
- lcov -q -c -d ${CI_PROJECT_DIR}/build/ -o ${CI_PROJECT_DIR}/coverage/${CI_JOB_NAME}.out
cache:
key: build
paths:
- build/
policy: pull
allow_failure: true # TODO: should be removed once the problems are fixed!
artifacts:
@@ -24,5 +33,6 @@ example_wideio:
- build/simulator/wideio-example_wideio_ch1.tdb
- build/simulator/wideio-example_wideio_ch2.tdb
- build/simulator/wideio-example_wideio_ch3.tdb
- coverage/${CI_JOB_NAME}.out
expire_in: 2 days

View File

@@ -6,7 +6,7 @@ framework that consists of models reflecting the DRAM functionality, power
consumption, temperature behaviour and retention time errors.
Pipeline Status: [![pipeline status](https://git.eit.uni-kl.de/ems/astdm/dram.sys/badges/master/pipeline.svg)](https://git.eit.uni-kl.de/ems/astdm/dram.sys/commits/master)
[![Coverage report](https://git.eit.uni-kl.de/ems/astdm/dram.sys/badges/master/coverage.svg?job=coverage)](https://git.eit.uni-kl.de/ems/astdm/dram.sys/commits/master)
## Basic Setup
Open a terminal window, go to your home directory, create a directory for your