Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Command line recipe

Prerequisite

The highest version (build 2.1.5320) emma jar file needs to be downloaded from Emma home. The jar needs to be placed in {$JAVA_HOME}/jre/lib/ext or added to the classpath of the following commands. This is also true for the JAVA_HOME seen by the Sakai server.

Javac compiles the source code with debug option on
Note: Running maven pack-demo compiles with debug on by default

The source code is available for report generation
Note: This simple Perl script

...

copies all the source code from Sakai source into one directory
structure instead of the source being scattered under the java/src directories.

This approach allows report generation for all reports to point to the same source code directory and avoids extra work.

$root=When you have your Sakai source code
$target=Where you want your condensed tree
$filter=The directory pattern to search for

Code Block
titleExample source code condenser
borderStylesolid
#!/usr/bin/perl
use File::Copy;
use File::Find;

my $root="/home/alan/temp/coverage/src/trunk";
my $target="/home/alan/temp/coverage/src/condensed_trunk";
my $filter="src/java/";
my @parts;

print "Copying and condensing source ready for htmlzing\n";
mkdir("$target", 0755) || die "Cannot mkdir $target: $!";
find (\&wanted, $root);

sub wanted{
    @parts=split(/$filter/,$File::Find::name);
    if ((-d $_)&&($parts[1] ne "")){
        if (!(-d "$target/$parts[1]" )){
             mkdir("$target/$parts[1]", 0755) || die "Cannot mkdir $target/$parts[1]: $!";
        }
    }else{
        if ($_=~/.java$/){
             copy($File::Find::name,"$target/$parts[1]") or print "Naming error: File cannot be copied.\n$File::Find::name";
        }
    }
}

...

...

Instrument code

Once emma.jar sits in the appropriate directory then the following command should bring up the help information for EMMA:

...

Code Block
titleResulting output
borderStylesolid
emma usage: emma <command> command options,
  where <command> is one of:

   run     application runner same as 'emmarun' tool;
   instr   offline instrumentation processor;
   ctl     remote control processor;

   merge   offline data file merge processor.
   report  offline report generator;

  use '<command> -h' to see usage help for a given command

EMMA v2.1, build 5320 (stable)

...