Rewrite the test doc generator to produce output in source order,
instead of arbitrarily.

Signed-off-by: John Snow <[email protected]>
---
 tests/qapi-schema/doc-good.out | 82 +++++++++++++++++-----------------
 tests/qapi-schema/test-qapi.py |  9 ++--
 2 files changed, 46 insertions(+), 45 deletions(-)

diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out
index 8c0818a3f0d..a8e71d182bc 100644
--- a/tests/qapi-schema/doc-good.out
+++ b/tests/qapi-schema/doc-good.out
@@ -54,15 +54,15 @@ event EVT_BOXED Object
     boxed=True
     feature feat3
 doc freeform
-    Plain
+    section=Plain
 *******
 Section
 *******
 doc freeform
-    Plain
+    section=Plain
 Just text, no heading.
 doc freeform
-    Plain
+    section=Plain
 Subsection
 ==========
 
@@ -106,84 +106,84 @@ Examples:
 - *verbatim*
 - {braces}
 doc symbol=Enum
-    Intro
+    section=Intro
 
-    Member=one
+    arg=one
 The _one_ {and only}, description on the same line
-    Member=two
+    arg=two
 
-    Feature=enum-feat
+    feature=enum-feat
 Also _one_ {and only}
-    Feature=enum-member-feat
+    feature=enum-member-feat
 a member feature
-    Plain
+    section=Plain
 @two is undocumented
 doc symbol=Base
-    Intro
+    section=Intro
 
-    Member=base1
+    arg=base1
  description starts on a new line,
  minimally indented
 doc symbol=Variant1
-    Intro
+    section=Intro
     A paragraph
 
     Another paragraph
 
     @var1 is undocumented
-    Member=var1
+    arg=var1
 
-    Feature=variant1-feat
+    feature=variant1-feat
 a feature
-    Feature=member-feat
+    feature=member-feat
 a member feature
 doc symbol=Variant2
-    Intro
+    section=Intro
 
 doc symbol=Object
-    Intro
+    section=Intro
 
-    Feature=union-feat1
+    feature=union-feat1
 a feature
 doc symbol=Alternate
-    Intro
+    section=Intro
 
-    Member=i
+    arg=i
 description starts on the same line
     remainder indented the same
     @b is undocumented
-    Member=b
+    arg=b
 
-    Feature=alt-feat
+    feature=alt-feat
 a feature
 doc freeform
-    Plain
+    section=Plain
 Another subsection
 ==================
 doc symbol=cmd
-    Intro
+    section=Intro
 
-    Member=arg1
+    arg=arg1
     description starts on a new line,
     indented
-    Member=arg2
+    arg=arg2
 description starts on the same line
     remainder indented differently
-    Member=arg3
+    arg=arg3
 
-    Feature=cmd-feat1
+    feature=cmd-feat1
 a feature
-    Feature=cmd-feat2
+    feature=cmd-feat2
 another feature
-    Plain
+    section=Plain
 .. note:: @arg3 is undocumented
-    Returns
+    section=Returns
 @Object
-    Errors
+    section=Errors
 some
-    Todo
+    section=Todo
 frobnicate
-    Plain
+    section=Plain
 .. admonition:: Notes
 
  - Lorem ipsum dolor sit amet
@@ -207,24 +207,24 @@ Examples::
 
 Note::
     Ceci n'est pas une note
-    Since
+    section=Since
 2.10
 doc symbol=cmd-boxed
-    Intro
+    section=Intro
     If you're bored enough to read this, go see a video of boxed
     cats
-    Feature=cmd-feat1
+    feature=cmd-feat1
 a feature
-    Feature=cmd-feat2
+    feature=cmd-feat2
 another feature
-    Plain
+    section=Plain
 .. qmp-example::
 
    -> "this example"
 
    <- ... has no title ...
 doc symbol=EVT_BOXED
-    Intro
+    section=Intro
 
-    Feature=feat3
+    feature=feat3
 a feature
diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py
index 5beb96e894f..27885147b4d 100755
--- a/tests/qapi-schema/test-qapi.py
+++ b/tests/qapi-schema/test-qapi.py
@@ -118,11 +118,12 @@ def test_frontend(fname):
         else:
             print('doc freeform')
         for section in doc.all_sections:
-            if isinstance(section, QAPIDoc.ArgSection):
-                print('    %s=%s' % (section.kind, section.name))
+            if section.kind == QAPIDoc.Kind.MEMBER:
+                print('    arg=%s\n%s' % (section.name, section.text))
+            elif section.kind == QAPIDoc.Kind.FEATURE:
+                print('    feature=%s\n%s' % (section.name, section.text))
             else:
-                print('    %s' % section.kind)
-            print(section.text)
+                print('    section=%s\n%s' % (section.kind, section.text))
 
 
 def open_test_result(dir_name, file_name, update):
-- 
2.55.0


Reply via email to