[PATCHES] Doxygen for smbtorture

Christof Schmitt cs at samba.org
Wed Oct 7 18:26:30 UTC 2015


The only documentation for smbtorture is the actual source code. These
patches start adding doxygen comments to make browsing the testcases a
bit easier. This is mostly an example to find out whether others would
also find this useful. If yes, i can (time permitting) add more doxygen
comments to the other testcases.

Christof
-------------- next part --------------
From d6e3e3b2e02fa5356a49b76fb29595964dc073d2 Mon Sep 17 00:00:00 2001
From: Christof Schmitt <cs at samba.org>
Date: Wed, 7 Oct 2015 10:34:38 -0700
Subject: [PATCH 1/3] torture: Add DoxyFile

Based on source3/DoxyFile

Signed-off-by: Christof Schmitt <cs at samba.org>
---
 source4/torture/Doxyfile |  190 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 190 insertions(+), 0 deletions(-)
 create mode 100644 source4/torture/Doxyfile

diff --git a/source4/torture/Doxyfile b/source4/torture/Doxyfile
new file mode 100644
index 0000000..f37e270
--- /dev/null
+++ b/source4/torture/Doxyfile
@@ -0,0 +1,190 @@
+# Doxyfile 1.5.3
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = smbtorture
+PROJECT_NUMBER         = HEAD
+
+# NOTE: By default, Doxygen writes into the dox/ subdirectory of the
+# invocation directory.  If you want to put it somewhere else, for
+# example, to write straight into a webserver directory, then override
+# this variable in a configuration concatenated to this one: Doxygen
+# doesn't mind variables being redefined.
+
+OUTPUT_DIRECTORY       = dox
+OUTPUT_LANGUAGE        = English
+DOXYFILE_ENCODING      = UTF-8
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ALWAYS_DETAILED_SEC    = NO
+FULL_PATH_NAMES        = YES
+STRIP_FROM_PATH        = $(PWD)/
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = YES
+INHERIT_DOCS           = YES
+TAB_SIZE               = 8
+ALIASES                =
+OPTIMIZE_OUTPUT_FOR_C  = YES
+DISTRIBUTE_GROUP_DOC   = NO
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_STATIC         = YES
+EXTRACT_LOCAL_CLASSES  = YES
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = YES
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = NO
+SORT_BRIEF_DOCS        = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = YES
+WARNINGS               = NO
+WARN_IF_UNDOCUMENTED   = NO
+WARN_IF_DOC_ERROR      = NO
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = . 
+INPUT_ENCODING         = UTF-8
+FILE_PATTERNS          = *.c \
+                         *.h
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = YES
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = NO
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+REFERENCES_LINK_SOURCE = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = YES
+COLS_IN_ALPHA_INDEX    = 1
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = .
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = NO
+TOC_EXPAND             = NO
+DISABLE_INDEX          = NO
+ENUM_VALUES_PER_LINE   = 3
+GENERATE_TREEVIEW      = NO
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = YES
+USE_PDFLATEX           = YES
+LATEX_BATCHMODE        = YES
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+#---------------------------------------------------------------------------
+# configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = NO
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = 
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+HAVE_DOT               = NO
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = YES
+CALLER_GRAPH           = YES
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+DOT_GRAPH_MAX_NODES    = 50
+MAX_DOT_GRAPH_DEPTH    = 0
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
-- 
1.7.1


From cc0258ec22b0638efb790cb42e14c3a86df011c0 Mon Sep 17 00:00:00 2001
From: Christof Schmitt <cs at samba.org>
Date: Wed, 7 Oct 2015 10:59:03 -0700
Subject: [PATCH 2/3] torture: Convert existing documentation for smb2.rename to doxygen

Signed-off-by: Christof Schmitt <cs at samba.org>
---
 source4/torture/smb2/rename.c |  117 ++++++++++++++++++++++++++++-------------
 1 files changed, 81 insertions(+), 36 deletions(-)

diff --git a/source4/torture/smb2/rename.c b/source4/torture/smb2/rename.c
index 23fe4f9..cf1d3a5 100755
--- a/source4/torture/smb2/rename.c
+++ b/source4/torture/smb2/rename.c
@@ -41,11 +41,17 @@
 
 #define BASEDIR "test_rename"
 
-/*
- * basic testing of rename: open file with DELETE access
- * this should pass
+/**
+ * Testcase smb2.rename.simple
+ *
+ * Basic testing of rename: open file with DELETE access. This should
+ * pass.
+ *
+ * @param torture torture context
+ * @param tree1 SMB2 tree context
+ *
+ * @return boolean Returns true if test succeeded, false if not.
  */
-
 static bool torture_smb2_rename_simple(struct torture_context *torture,
 		struct smb2_tree *tree1)
 {
@@ -130,11 +136,17 @@ done:
 	return ret;
 }
 
-/*
- * basic testing of rename, this time do not request DELETE access
- * for the file, this should fail
+/**
+ * Testcase smb2.rename.simple2
+ *
+ * Basic testing of rename, this time do not request DELETE access
+ * for the file, this should fail.
+ *
+ * @param torture torture context
+ * @param tree1 SMB2 tree context
+ *
+ * @return boolean Returns true if test succeeded, false if not.
  */
-
 static bool torture_smb2_rename_simple2(struct torture_context *torture,
 		struct smb2_tree *tree1)
 {
@@ -210,11 +222,16 @@ done:
 }
 
 
-/*
- * testing of rename with no sharing allowed on file
- * this should work
+/**
+ * Testcase smb2.rename_nosharing
+ *
+ * Testing of rename with no sharing allowed on file. This should work.
+ *
+ * @param torture torture context
+ * @param tree1 SMB2 tree context
+ *
+ * @return boolean Returns true if test succeeded, false if not.
  */
-
 static bool torture_smb2_rename_no_sharemode(struct torture_context *torture,
 		struct smb2_tree *tree1)
 {
@@ -298,12 +315,17 @@ done:
 	return ret;
 }
 
-/*
- * testing of rename when opening parent dir with delete access and delete
- * sharing allowed
- * should result in sharing violation
+/**
+ * Testcase smb2.rename.share_delete_and_delete_access
+ *
+ * Testing of rename when opening parent dir with delete access and
+ * delete sharing allowed should result in sharing violation.
+ *
+ * @param torture torture context
+ * @param tree1 SMB2 tree context
+ *
+ * @return boolean Returns true if test succeeded, false if not.
  */
-
 static bool torture_smb2_rename_with_delete_access(struct torture_context *torture,
 		struct smb2_tree *tree1)
 {
@@ -423,12 +445,18 @@ done:
 }
 
 
-/*
- * testing of rename with delete access on parent dir
- * this is a variation of the test above: parent dir is opened
- * without share_delete, so rename must fail
+/**
+ * Testcase smb2.rename.no_share_delete_but_delete_access
+ *
+ * Testing of rename with delete access on parent dir. This is a
+ * variation of the test above: parent dir is opened without
+ * share_delete, so rename must fail.
+ *
+ * @param torture torture context
+ * @param tree1 SMB2 tree context
+ *
+ * @return boolean Returns true if test succeeded, false if not.
  */
-
 static bool torture_smb2_rename_with_delete_access2(struct torture_context *torture,
 		struct smb2_tree *tree1)
 {
@@ -546,12 +574,17 @@ done:
 	return ret;
 }
 
-/*
- * testing of rename when opening parent dir with no delete access and delete
- * sharing allowed
- * this should pass
+/**
+ * Testcase smb2.rename.share_delete_no_delete_access
+ *
+ * Testing of rename when opening parent dir with no delete access and delete
+ * sharing allowed. This should pass.
+ *
+ * @param torture torture context
+ * @param tree1 SMB2 tree context
+ *
+ * @return boolean Returns true if test succeeded, false if not.
  */
-
 static bool torture_smb2_rename_no_delete_access(struct torture_context *torture,
 		struct smb2_tree *tree1)
 {
@@ -681,12 +714,19 @@ done:
 }
 
 
-/*
- * testing of rename with no delete access on parent dir
- * this is the negative case of the test above: parent dir is opened
- * without share_delete, so rename must fail
+/**
+ * Testcase smb2.rename.no_share_delete_no_delete_access
+ *
+ * Testing of rename with no delete access on parent dir.  This is the
+ * negative case of the test above: Parent dir is opened without
+ * share_delete, so rename must fail.
+ *
+ *
+ * @param torture torture context
+ * @param tree1 SMB2 tree context
+ *
+ * @return boolean Returns true if test succeeded, false if not.
  */
-
 static bool torture_smb2_rename_no_delete_access2(struct torture_context *torture,
 		struct smb2_tree *tree1)
 {
@@ -804,11 +844,16 @@ done:
 	return ret;
 }
 
-/*
- * this is a replay of how Word 2010 saves a file
- * this should pass
+/**
+ * Testcase smb2.rename.msword
+ *
+ * This is a replay of how Word 2010 saves a file this should pass.
+ *
+ * @param torture torture context
+ * @param tree1 SMB2 tree context
+ *
+ * @return boolean Returns true if test succeeded, false if not.
  */
-
 static bool torture_smb2_rename_msword(struct torture_context *torture,
 		struct smb2_tree *tree1)
 {
-- 
1.7.1


From 9b14d180d90f34644818634cf9efeced61543754 Mon Sep 17 00:00:00 2001
From: Christof Schmitt <cs at samba.org>
Date: Wed, 7 Oct 2015 11:19:38 -0700
Subject: [PATCH 3/3] torture: Add doxygen comments for remaining testcases in smb2.rename

Signed-off-by: Christof Schmitt <cs at samba.org>
---
 source4/torture/smb2/rename.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/source4/torture/smb2/rename.c b/source4/torture/smb2/rename.c
index cf1d3a5..cbcc0ad 100755
--- a/source4/torture/smb2/rename.c
+++ b/source4/torture/smb2/rename.c
@@ -973,6 +973,17 @@ done:
 	return ret;
 }
 
+/**
+ * Testcase smb2.rename.rename_dir_openfile
+ *
+ * Test renaming directory while file in directory is open. This
+ * should fail.
+ *
+ * @param torture torture context
+ * @param tree1 SMB2 tree context
+ *
+ * @return boolean Returns true if test succeeded, false if not.
+ */
 static bool torture_smb2_rename_dir_openfile(struct torture_context *torture,
 					     struct smb2_tree *tree1)
 {
@@ -1413,6 +1424,18 @@ static NTSTATUS rename_dirs_bench_recv(struct tevent_req *req)
 	return tevent_req_simple_recv_ntstatus(req);
 }
 
+/**
+ * Testcase smb2.rename.rename_dir_bench
+ *
+ * This is a little benchmark test excercising parallel directory
+ * renames. With lots of open files directory renames get pretty slow
+ * against some SMB server implementations.
+ *
+ * @param torture torture context
+ * @param tree1 SMB2 tree context
+ *
+ * @return boolean Returns true if test succeeded, false if not.
+ */
 static bool torture_smb2_rename_dir_bench(struct torture_context *tctx,
 					  struct smb2_tree *tree)
 {
-- 
1.7.1



More information about the samba-technical mailing list