doc: Clarify what should be cleaned up at test end
RFC PATCH 1/1 doc: Clarify what should be cleaned up at test end
This adds a short paragraph that writes down previously unwritten rule for resource cleanup.
--- doc/test-writing-guidelines.txt | 8 ++++++++ 1 file changed, 8 insertions(+)
doc/test-writing-guidelines.txt +8 -0
@@ -347,6 +347,14 @@ assigned a valid file descriptor. For most of the things you need to create extra flag that is set right after successful initialization though. Consider, for example, test setup below. +We also prefer cleaning up resources that would otherwise be released on the +program exit. There are two main reasons for this decision. Resources such as +file descriptors and mmaped memory could block umounting a block device in +cases where the test library has mounted a filesystem for the test temporary +directory. Not freeing allocated memory would upset static analysis and tools +such as valgrind and produce false-positives when checking for leaks in the +libc and other low level libraries. + [source,c] ------------------------------------------------------------------------------- static int fd0, fd1, mount_flag;
Signature · 1 line
2.19.2
RFC PATCH 1/1 doc: Clarify what should be cleaned up at test end
----- Original Message -----
Quoted 27 lines
This adds a short paragraph that writes down previously unwritten rule for resource cleanup.
Signed-off-by Cyril Hrubis <[email protected]>CC Jan Stancek <[email protected]>--- doc/test-writing-guidelines.txt | 8 ++++++++ 1 file changed, 8 insertions(+)doc/test-writing-guidelines.txt +0
-0@@ -347,6 +347,14 @@ assigned a valid file descriptor. For most of the thingsyou need to create
extra flag that is set right after successful initialization though. Consider,
for example, test setup below.doc/test-writing-guidelines.txt +2
-0+We also prefer cleaning up resources that would otherwise be released on the +program exit. There are two main reasons for this decision. Resources suchas
doc/test-writing-guidelines.txt +3
-0+file descriptors and mmaped memory could block umounting a block device in +cases where the test library has mounted a filesystem for the test temporary +directory. Not freeing allocated memory would upset static analysis andtools
doc/test-writing-guidelines.txt assigned a valid file descriptor. For most of the things you need to create · line 357
Quoted 3 lines
doc/test-writing-guidelines.txt +3
-0+such as valgrind and produce false-positives when checking for leaks in the +libc and other low level libraries. +
I'm OK with the text. Do we leave the paragraph we talked about in style-guide.txt?
Quoted 7 lines
[source,c]
-------------------------------------------------------------------------------
static int fd0, fd1,mount_flag;
--
2.19.2
RFC PATCH 1/1 doc: Clarify what should be cleaned up at test end
Hi!
Quoted 1 line
I'm OK with the text. Do we leave the paragraph we talked about in style-guide.txt?
The document has to be revisited anyways, I added that to my TODO now.
Signature · 2 lines
Cyril Hrubis [email protected]
RFC PATCH 1/1 doc: Clarify what should be cleaned up at test end
In reply to Cyril HrubisHi Cyril,
Quoted 5 lines
This adds a short paragraph that writes down previously unwritten rule for resource cleanup.
Signed-off-by Cyril Hrubis <[email protected]>CC Jan Stancek <[email protected]>
LGTM.
Kind regards,
Petr
RFC PATCH 1/1 doc: Clarify what should be cleaned up at test end
Hi!
Pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]