Add test descriptions for lcov
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 592417a..ac4be4c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -76,6 +76,9 @@
     COMMAND tests/scripts/test-ref-configs.pl
     )
 
+# add programs/test/selftest even though the selftest functions are
+# called from the testsuites since it runs them in verbose mode,
+# avoiding spurious "uncovered" printf lines
 ADD_CUSTOM_TARGET(covtest
     COMMAND make test
     COMMAND programs/test/selftest
@@ -84,13 +87,14 @@
     )
 
 ADD_CUSTOM_TARGET(lcov
-    COMMAND lcov --capture --directory . -o polarssl.info
-    COMMAND genhtml --title PolarSSL --legend --no-branch-coverage -o ../../../Coverage polarssl.info
-    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/library/CMakeFiles/polarssl.dir
+    COMMAND rm -rf Coverage
+    COMMAND lcov --capture --directory library/CMakeFiles/polarssl.dir -o polarssl.info
+    COMMAND gendesc tests/Descriptions.txt -o descriptions
+    COMMAND genhtml --title PolarSSL --description-file descriptions --keep-descriptions --legend --no-branch-coverage -o Coverage polarssl.info
+    COMMAND rm -f polarssl.info descriptions
     )
 
 ADD_CUSTOM_TARGET(memcheck
-    COMMAND rm -rf Coverage
     COMMAND ctest -O memcheck.log -D ExperimentalMemCheck
     COMMAND tail -n1 memcheck.log | grep 'Memory checking results:' > /dev/null
     COMMAND rm -f memcheck.log
diff --git a/Makefile b/Makefile
index e9eb11f..d8485b2 100644
--- a/Makefile
+++ b/Makefile
@@ -56,17 +56,23 @@
 test-ref-configs:
 	tests/scripts/test-ref-configs.pl
 
+# note: for coverage testing, build with:
+# CFLAGS='--coverage' make OFLAGS='-g3 -O0'
 testcov:
 	make check
+	# add programs/test/selftest even though the selftest functions are
+	# called from the testsuites since it runs them in verbose mode,
+	# avoiding spurious "uncovered" printf lines
 	programs/test/selftest
 	( cd tests && ./compat.sh )
 	( cd tests && ./ssl-opt.sh )
 
 lcov:
 	rm -rf Coverage
-	( cd library && lcov --capture --directory . -o polarssl.info )
-	( cd library && genhtml --title PolarSSL --legend --no-branch-coverage \
-	    -o ../Coverage polarssl.info )
+	lcov --capture --directory library -o polarssl.info
+	gendesc tests/Descriptions.txt -o descriptions
+	genhtml --title PolarSSL --description-file descriptions --keep-descriptions --legend --no-branch-coverage -o Coverage polarssl.info
+	rm -f polarssl.info descriptions
 
 apidoc:
 	mkdir -p apidoc
diff --git a/tests/Descriptions.txt b/tests/Descriptions.txt
new file mode 100644
index 0000000..5b546e9
--- /dev/null
+++ b/tests/Descriptions.txt
@@ -0,0 +1,16 @@
+test_suites
+    The various 'test_suite_XXX' programs from the 'tests' directory, executed
+    using 'make check' (Unix make) or 'make test' (Cmake), include test cases
+    (reference test vectors, sanity checks, etc.) for all modules except the
+    SSL modules.
+
+compat
+    The 'tests/compat.sh' script checks interoperability with OpenSSL for every
+    ciphersuite, in every version, using client authentication or not.  For
+    each ciphersuite/version it performs a full handshake and a small data
+    exchange.
+
+ssl_opt
+    The 'tests/ssl-opt.sh' script checks various options and/or operations not
+    covered by compat.sh: session resumption (using session cache or tickets),
+    renegotiation, SNI, other extensions, etc.