]> git.donarmstrong.com Git - lilypond.git/commitdiff
Allow header/footer snippets in test cases, expand lilypond-book to insert versionnumber
authorReinhold Kainhofer <reinhold@kainhofer.com>
Thu, 4 Oct 2007 08:54:52 +0000 (10:54 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Thu, 4 Oct 2007 08:54:52 +0000 (10:54 +0200)
-) Add --introduction=.. and --footer=.. options to lys-to-tely.py so that we
   can insert custom text form a texi file at the beginning and end of a
   regression test page. So far, one had to add a .ly file with a proper name
   (so that it gets sorted to the begin/end), which resulted in an ugly empty
   image and a link to a dummy .ly file at the top. The header for the
 lys-to-tely script must not be called *.texi, because make WWW tries to
 run makeinfo on all *.texi files.
-) Change the buildsystem to use these additional parameters. The make variables
   HEADER_FILE and FOOTER_FILE are used for this.
-) Change the regression tests to make use of the texi file rather than the
   AAA-intro-regression.ly file
-) Since that header contained the lilypond version number, I also expanded
   lilypond-book to replace @lilypondversion (or the \lilypondversion and
   <lilypondversion> counterparts for latex and html) by the version. The
   build must then use the lilypond-book script from scripts/out/ rather
   than scripts/lilypond-book.py (which does not have the @VERSION_NUMBER@
   replaced by the version by the build system).

buildscripts/lys-to-tely.py
input/regression/AAA-intro-regression-texi [new file with mode: 0644]
input/regression/AAA-intro-regression.ly [deleted file]
input/regression/GNUmakefile
input/regression/musicxml/GNUmakefile
input/regression/musicxml/intro-texi [new file with mode: 0644]
make/lilypond-vars.make
make/lysdoc-rules.make
scripts/lilypond-book.py

index 9150acfe393296ab87ba34e95cdf3cce9e2712ba..c0a66457a95b5d33bf8dfa46b0a36b61ad10c3cb 100644 (file)
@@ -6,7 +6,6 @@ TODO:
 
  * Add @nodes, plit at sections?
  * Less kludged first introduction file
- * include *.texi files for text at start of section?
 
 '''
 
@@ -24,17 +23,21 @@ Construct tely doc from LY-FILEs.
 
 Options:
  -h, --help                print this help
- -o, --output=NAME         write tely doc to NAME
+ -n, --name=NAME         write tely doc to NAME
  -t, --title=TITLE         set tely doc title TITLE
+ -i, --introduction=FILE   use FILE as intruduction at the top
+ -f, --footer=FILE         use FILE as footer on the bottom of the page
 
 """)
     sys.exit (0)
 
-(options, files) = getopt.getopt(sys.argv[1:], 'hn:t:', [
-    'help', 'name=', 'title='])
+(options, files) = getopt.getopt(sys.argv[1:], 'hn:t:i:f:', [
+    'help', 'name=', 'title=', 'introduction=', 'footer='])
 
 name="ly-doc"
 title="Ly Doc"
+header = None
+footer = None
 for opt in options:
     o = opt[0]
     a = opt[1]
@@ -44,6 +47,10 @@ for opt in options:
         name = a
     elif o == '-t' or o == '--title':
         title = a
+    elif o == '-i' or o == '--introduction':
+        header = a
+    elif o == '-f' or o == '--footer':
+        footer = a
     else:
         raise 'unknown opt ', o
 
@@ -79,6 +86,11 @@ if files:
 @node Top, , , (dir)
 ''' % (name, title, title)
 
+    if header:
+        header_text = open (header).read ()
+        s += header_text
+
+
     def name2line (n):
         # UGR
         s = r"""
@@ -93,7 +105,12 @@ if files:
         return s
     files.sort ()
     s = s + string.join (map (lambda x: name2line (x), files), "\n")
-    s = s + '\n@bye\n'
+    s += '\n'
+    if footer:
+        footer_text = open (footer).read ()
+        s += footer_text
+        s += '\n'
+    s = s + '@bye\n'
     f = "%s/%s.tely" % (dir, name)
     sys.stderr.write ("%s: writing %s..." % (program_name, f))
     h = open (f, "w")
diff --git a/input/regression/AAA-intro-regression-texi b/input/regression/AAA-intro-regression-texi
new file mode 100644 (file)
index 0000000..b270e6b
--- /dev/null
@@ -0,0 +1,13 @@
+@unnumbered Introduction
+
+This document presents proofs for LilyPond @lilypondversion. When the
+text corresponds with the shown notation, we consider LilyPond Officially
+BugFree (tm).  This document is intended for finding bugs and for
+documenting bugfixes.
+
+In the web version of this document, you can click on the file name 
+or figure for each example to see the corresponding input file.
+
+TODO: order of tests (file names!), test only one feature per test.
+Smaller and neater tests.
+
diff --git a/input/regression/AAA-intro-regression.ly b/input/regression/AAA-intro-regression.ly
deleted file mode 100644 (file)
index d19595b..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-\version "2.10.0"
-%% +.ly: Be the first .ly file for lys-to-tely.py.
-%% Better to make lys-to-tely.py include "introduction.texi" or
-%% other .texi documents too?
-
-
-\header{
-texidoc =
-
-#(string-append "@unnumbered Introduction
-
-This document presents proofs for
-LilyPond " (lilypond-version) ".  When the
-text corresponds with the shown notation, we consider LilyPond Officially
-BugFree (tm).  This document is intended for finding bugs and for
-documenting bugfixes.
-
-In the web version of this document, you can click on the file name 
-or figure for each example to see the corresponding input file.
-
-TODO: order of tests (file names!), test only one feature per test.
-Smaller and neater tests.
-")
-
-}
-
-%
-% make sure the .png is generated.
-%
-\lyrics { "(left blank intentionally)" }
-
index 753d483bd9674586a235df824d340bae816f184f..a57130bf6385fe03195e04d5485097e23c1f10b3 100644 (file)
@@ -5,5 +5,7 @@ LOCALSTEPMAKE_TEMPLATES=lilypond ly lysdoc
 
 include $(depth)/make/stepmake.make
 TITLE=LilyPond Regression Tests
+HEADER_FILE=AAA-intro-regression-texi
+FOOTER_FILE=
 
 SUBDIRS=musicxml
index ec647d85079d052b9ae5b3de558105274d6a75cc..a6809e8b336d5e24073ce75d2b65bbd203b783b8 100644 (file)
@@ -4,5 +4,6 @@ STEPMAKE_TEMPLATES=documentation texinfo tex
 LOCALSTEPMAKE_TEMPLATES=lilypond ly lysdoc musicxml
 
 include $(depth)/make/stepmake.make
-TITLE=Lilypon musicxml2ly Regression Tests
-
+TITLE=Lilypond musicxml2ly Regression Tests
+HEADER_FILE=intro-texi
+FOOTER_FILE=
diff --git a/input/regression/musicxml/intro-texi b/input/regression/musicxml/intro-texi
new file mode 100644 (file)
index 0000000..ffbf320
--- /dev/null
@@ -0,0 +1,18 @@
+@unnumbered MusicXML regression and coverage test
+
+This document presents proofs for the musicxml2ly script provided with
+LilyPond @lilypondversion. The files don't have a description yet, so 
+there is no official indication when the output is wrong.
+These snippets are provided as unit test files in MusicXML, converted to
+a .ly file by musicxml2ly and then processed by lilypond as usual.
+
+If something does not seem wright in the output, it might either be that this
+feature has not been implemented, has been wrongly implemented, or a regression
+has crept in recently...
+This document is intended for finding bugs and for documenting bugfixes.
+
+In the web version of this document, you can click on the file name 
+or figure for each example to see the corresponding .ly intermediary file.
+
+TODO: Find a way to add a description to the .ly files for texinfo.
+
index cf9093523b8b861933625e4de73347eb29c4a91c..fe8820bd0b7945b004e8ad3bbc91e2776dbdc9a5 100644 (file)
@@ -22,7 +22,7 @@ the-script-dir=$(wildcard $(script-dir))
 ABC2LY = $(script-dir)/abc2ly.py
 MUSICXML2LY = $(script-dir)/musicxml2ly.py
 CONVERT_LY = $(script-dir)/convert-ly.py
-LILYPOND_BOOK = $(script-dir)/lilypond-book.py
+LILYPOND_BOOK = $(script-dir)/out/lilypond-book
 
 ## ugh : fix me, input/new/pitch
 LILYPOND_BOOK_INCLUDES = -I $(src-dir)/ -I $(outdir) -I $(input-dir) -I $(input-dir)/regression/ -I $(input-dir)/manual/ -I $(input-dir)/tutorial/ -I $(top-build-dir)/mf/$(outconfbase)/  -I $(top-build-dir)/mf/out/ -I $(input-dir)/new/pitch
index 21c675e84897a447804608e801d9525a62092b23..331231e8e6fb75fc7b5e879d51316d0dce1c1e49 100644 (file)
@@ -1,4 +1,4 @@
 
 $(outdir)/collated-files.tely: $(LY_FILES) $(OUT_LY_FILES)
-       $(PYTHON) $(buildscript-dir)/lys-to-tely.py --name=$(outdir)/collated-files --title="$(TITLE)" $^
+       $(PYTHON) $(buildscript-dir)/lys-to-tely.py --name=$(outdir)/collated-files --introduction="$(HEADER_FILE)" --footer="$(FOOTER_FILE)" --title="$(TITLE)" $^
 
index 5b9c0d738f9b9669ee43eba424060a7b9a3cb423..459900124169d8109192904393938e8c4b0f1c13 100644 (file)
@@ -248,6 +248,9 @@ snippet_res = {
           (?P<match>
           <(?P<inline>(inline)?)mediaobject>\s*<imageobject.*?>\s*<imagedata\s+fileref="(?P<filename>.*?\.ly)"\s*(role="(?P<options>.*?)")?\s*(/>|>\s*</imagedata>)\s*</imageobject>\s*</(inline)?mediaobject>)''',
 
+        'lilypond_version':
+         no_match,
+
         'multiline_comment':
          r'''(?smx)
           (?P<match>
@@ -263,7 +266,6 @@ snippet_res = {
 
         'verbatim':
        no_match,
-       
     }, 
     ##
     HTML: {
@@ -296,6 +298,9 @@ snippet_res = {
           \s*(?P<filename>.*?)\s*
           </lilypondfile>)''',
 
+        'lilypond_version':
+         r'''(?mx)(?P<match><lilypond-version>)''',
+
         'multiline_comment':
          r'''(?smx)
           (?P<match>
@@ -362,6 +367,9 @@ snippet_res = {
            (?P<filename>\S+?)
           })''',
 
+        'lilypond_version':
+         r'''(?P<match>\\lilypond_version)''',
+
         'multiline_comment':
          no_match,
 
@@ -430,6 +438,9 @@ snippet_res = {
            (?P<filename>\S+)
           })''',
 
+        'lilypond_version':
+         r'''(?mx)(?P<match>@lilypondversion)''',
+
         'multiline_comment':
          r'''(?smx)
           ^(?P<match>
@@ -1275,9 +1286,14 @@ class Lilypond_file_snippet (Lilypond_snippet):
         return ('\\sourcefilename \"%s\"\n\\sourcefileline 0\n%s'
                 % (name, contents))
 
+class Version_snippet (Snippet):
+    def replacement_text (self):
+        return (program_version)
+
 snippet_type_to_class = {
     'lilypond_file': Lilypond_file_snippet,
     'lilypond_block': Lilypond_snippet,
+    'lilypond_version': Version_snippet,
     'lilypond': Lilypond_snippet,
     'include': Include_snippet,
 }
@@ -1688,6 +1704,7 @@ def do_file (input_filename):
     #                'verb',
             'singleline_comment',
             'lilypond_file',
+            'lilypond_version',
             'include',
             'lilypond',
         )