aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2018-07-03 18:42:32 +0200
committerJose Bollo <jose.bollo@iot.bzh>2018-07-03 19:24:01 +0200
commitf645c76e0bfa772aff97141389d45476bf091053 (patch)
tree724af18ff4b5b92aa071e93675582b67c11d1908
parent57e09344b57d98515bf02165e0e33a1d43134af0 (diff)
coverage: Add the missing files
The files weren't included due to git and gitignore. Also add a README.md to reproduce the test. Change-Id: Ifcdffaca32c369b2ff5fb82e246fa0cad87813f5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--.gitignore1
-rw-r--r--coverage/Makefile33
-rw-r--r--coverage/README.md9
-rw-r--r--coverage/apis/ws/fix-of-git0
-rw-r--r--coverage/bin/Makefile72
l---------coverage/ldpath/strong/hello.so1
l---------coverage/ldpath/strong/sub/hi3.so1
l---------coverage/ldpath/strong/sub/sub/salut.so1
l---------coverage/ldpath/weak/bug.so1
-rw-r--r--coverage/ldpath/weak/noise3.so0
l---------coverage/ldpath/weak/sub/bug.so1
l---------coverage/ldpath/weak/sub/hello.so1
12 files changed, 120 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index ea5c2c66..abc051fe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,7 +8,6 @@ dist/*
CMakeFiles/
CMakeCache.txt
nbproject/private/*
-Makefile
cmake_install.cmake
*.so
.vscode
diff --git a/coverage/Makefile b/coverage/Makefile
new file mode 100644
index 00000000..219321c7
--- /dev/null
+++ b/coverage/Makefile
@@ -0,0 +1,33 @@
+
+.PHONY: all
+
+all: report
+
+.PHONY: binaries
+
+binaries:
+ make -C bin -w binaries
+
+.PHONY: clean
+
+clean:
+ make -C bin -w clean
+ rm -rf lcov-out.info report
+
+.PHONY: test
+
+test: binaries
+ @echo -----------------------------------------
+ @echo -- BEGIN TEST
+ @echo -----------------------------------------
+ @scripts/run-test.sh
+ @echo -----------------------------------------
+ @echo -- END TEST
+ @echo -----------------------------------------
+
+report: test
+ @echo generating LCOV report
+ @lcov -c -d bin -o lcov-out.info
+ @echo generating report
+ @genhtml -s -o report lcov-out.info
+ @echo ready: xdg-open report/index.html
diff --git a/coverage/README.md b/coverage/README.md
new file mode 100644
index 00000000..def86b05
--- /dev/null
+++ b/coverage/README.md
@@ -0,0 +1,9 @@
+
+How to do test coverage?
+========================
+
+```bash
+cd coverage
+make report
+xdg-open report/index.html
+```
diff --git a/coverage/apis/ws/fix-of-git b/coverage/apis/ws/fix-of-git
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/coverage/apis/ws/fix-of-git
diff --git a/coverage/bin/Makefile b/coverage/bin/Makefile
new file mode 100644
index 00000000..a256a9a9
--- /dev/null
+++ b/coverage/bin/Makefile
@@ -0,0 +1,72 @@
+
+.PHONY: clean binaries
+
+heredir = .
+basedir = ../..
+
+targets = afb-daemon-cov afb-client hi3.so hello.so salut.so saha.so demat.so bug.so
+
+binaries: $(targets)
+
+clean:
+ @rm $(targets) *.gcno *.gcda
+
+#======================================================================================
+# creates the targets
+#======================================================================================
+
+incdir = $(basedir)/include
+srcdir = $(basedir)/src
+samdir = $(basedir)/bindings/samples
+
+bindir = $(heredir)/bin
+
+cflags = -I$(incdir) \
+ $(shell pkg-config --cflags --libs openssl libmicrohttpd json-c libsystemd uuid) \
+ -ldl -lrt -lpthread
+
+afb_lib_src = $(shell ls $(srcdir)/*.c | egrep -v '/afs-|/main-|-so-v1|-so-vdyn|-fake|-api-dbus|-api-v1' )
+afb_clib_src = $(shell ls $(srcdir)/*.c | egrep -v '/afs-|/main-|-so-v1|-so-vdyn|-fake|-api-dbus|-api-v1|afb-supervision' )
+
+afb_daemon_srcs = $(srcdir)/main-afb-daemon.c $(afb_lib_src)
+afb_daemon_defs = '-DAFB_VERSION="cov"' -DAGL_DEVEL -DWITH_MONITORING_OPTION '-DBINDING_INSTALL_DIR="fake"'
+
+afb_client_srcs = $(srcdir)/main-afb-client-demo.c $(afb_clib_src)
+afb_client_defs = '-DAFB_VERSION="cov"' '-DBINDING_INSTALL_DIR="fake"'
+
+hello3_src = $(samdir)/hello3.c
+hi_src = $(samdir)/hi3.c
+binding_flags = -shared -fPIC -Wl,--version-script=$(samdir)/export.map
+
+afb-daemon-cov: $(afb_daemon_srcs)
+ @echo creation of $@
+ @gcc -o $@ $(afb_daemon_srcs) --coverage $(afb_daemon_defs) $(cflags)
+
+afb-client: $(afb_client_srcs)
+ @echo creation of $@
+ @gcc -o $@ $(afb_client_srcs) $(afb_client_defs) $(cflags)
+
+hi3.so: $(hi3_src)
+ @echo creation of $@
+ @gcc -o $@ $(hi3_src) $(binding_flags) $(cflags)
+
+hello.so: $(hello3_src)
+ @echo creation of $@
+ @gcc -o $@ $(hello3_src) '-DAPINAME="hello"' $(binding_flags) $(cflags)
+
+salut.so: $(hello3_src)
+ @echo creation of $@
+ @gcc -o $@ $(hello3_src) '-DAPINAME="salut"' $(binding_flags) $(cflags)
+
+saha.so: $(hello3_src)
+ @echo creation of $@
+ @gcc -o $@ $(hello3_src) '-DAPINAME="saha"' $(binding_flags) $(cflags)
+
+demat.so: $(hello3_src)
+ @echo creation of $@
+ @gcc -o $@ $(hello3_src) '-DAPINAME="demat"' $(binding_flags) $(cflags)
+
+bug.so: bug.c
+ @echo creation of $@
+ @gcc -o $@ bug.c $(binding_flags) $(cflags)
+
diff --git a/coverage/ldpath/strong/hello.so b/coverage/ldpath/strong/hello.so
new file mode 120000
index 00000000..d6aad9c5
--- /dev/null
+++ b/coverage/ldpath/strong/hello.so
@@ -0,0 +1 @@
+../../bin/hello.so \ No newline at end of file
diff --git a/coverage/ldpath/strong/sub/hi3.so b/coverage/ldpath/strong/sub/hi3.so
new file mode 120000
index 00000000..243dc22b
--- /dev/null
+++ b/coverage/ldpath/strong/sub/hi3.so
@@ -0,0 +1 @@
+../../../bin/hi3.so \ No newline at end of file
diff --git a/coverage/ldpath/strong/sub/sub/salut.so b/coverage/ldpath/strong/sub/sub/salut.so
new file mode 120000
index 00000000..edddb6e4
--- /dev/null
+++ b/coverage/ldpath/strong/sub/sub/salut.so
@@ -0,0 +1 @@
+../../../../bin/salut.so \ No newline at end of file
diff --git a/coverage/ldpath/weak/bug.so b/coverage/ldpath/weak/bug.so
new file mode 120000
index 00000000..01e7c27a
--- /dev/null
+++ b/coverage/ldpath/weak/bug.so
@@ -0,0 +1 @@
+sub/bug.so \ No newline at end of file
diff --git a/coverage/ldpath/weak/noise3.so b/coverage/ldpath/weak/noise3.so
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/coverage/ldpath/weak/noise3.so
diff --git a/coverage/ldpath/weak/sub/bug.so b/coverage/ldpath/weak/sub/bug.so
new file mode 120000
index 00000000..352a6747
--- /dev/null
+++ b/coverage/ldpath/weak/sub/bug.so
@@ -0,0 +1 @@
+../../../bin/bug.so \ No newline at end of file
diff --git a/coverage/ldpath/weak/sub/hello.so b/coverage/ldpath/weak/sub/hello.so
new file mode 120000
index 00000000..b08e32c8
--- /dev/null
+++ b/coverage/ldpath/weak/sub/hello.so
@@ -0,0 +1 @@
+../../strong/hello.so \ No newline at end of file