[lsb-discuss] ALSA Test Markup: input.c and cards.c

Daniel Harrison nixscripter at gmail.com
Thu Feb 4 19:04:51 PST 2010

Jeff Licquia wrote:
> I've pushed these, as well as the ones from before.  We may want to
> correct some of the IDs in one ("snd_foo_bar" instead of
> "snd_foo_bar.01"), but otherwise didn't see anything that struck me as
> bad.  I'll admit, though, that the review wasn't very extensive.

Oh. I made that mistake quite a few times. I will make sure always to 
add the 01 in the future.

Also, I actually didn't use KompoZer for most of those, but a clever 
Perl script. I found myself doing something simple most of the time: 
highlight a one line description in a table listing the functions as a 
requirement. The pattern of markup KompoZer added when I did that was 
extremely predictable, so I wrote a script to copy that pattern and do 
it for every table entry in an entire file. After running it, I reviewed 
the files in KompoZer, and added extra requirements as needed -- but 
there weren't any in the last two files.

Here's that script. It is designed to be run on the *_8c.html files. 
Note the -p flag in the shebang line.
Dan Harrison

#!/usr/bin/perl -p
# Does testing markup quickly on a file. Reads from standard input or listed
# file names, writes to standard output.
# It looks for a table listing functions, and creates one requirement 
for every
# function consisting of its description text.
# In addition, it will add the CSS markup that the Kompozer tool does 
when you
# turn requirements on for the file.
# This is designed to be a simple, first-pass script. Human review is 
# advised after it has been run. Additionally, it makes many assumptions 
# the markup of the input files, and may display strange behavior in the 
face of
# different line organization of its input HTML.
# Usage: markup.pl fileone_8c.html >output.html
# OR
# markup < fileone_8c.html >output.html
# by nixscripter at gmail.com, freely given to the public domain

# Stamp on the extra CSS code for the requirement markup.
$css = '<style id="reqstyle">
.req { background-color: rgb(255, 255, 153);}
s@(\<link href="tabs.css" rel="stylesheet" 

# Now the iterative processing. First, ignore lines we are not 
interested in.
next unless m/^<tr>/;

# On first lines, Look for the function's name, which is marked with an 
      $func = $1 if m/a class="el"[^>]*>([^<]+)<\/a>/;
     #  Once the functions name has been found, the next line will contain a
     #  table row with its description, surrounded by a span.
     s/(<td class="mdescRight">)([^<]+)/$1<span class="req" 

     # Reset in preparation for the next row.
     $func = "";

More information about the lsb-discuss mailing list