Testing on VMS

From Perl QA
Jump to: navigation, search

Problem: you'd like to run your module's tests on VMS but you don't have a VMS box or VMS experience.

You can get access to a VMS box with HP TestDrive. Here's how to run your tests and perform a few other simple tasks.

Disclaimer: I'm a VMS newbie. If anything here is incorrect or suboptimal please edit it.

Contents

Upload your code

For security reasons the TestDrive machines can't make outgoing network connections but they are running an FTP server. Use your favourite FTP client to upload your module's tarball. Remember to select passive mode and enable binary transfers.

Now telnet into the same machine and unpack the tarball:

   $ gunzip -d HTML-TINY-0_905_TAR.GZ
   GUNZIP.EXE: HTML-TINY-0_905_TAR.GZ: decompression OK, trailing garbage ignored
   $ tar xf HTML-TINY-0_905_TAR

Change to the newly created directory

   $ set def [.html-tiny-0_905]
   $ dir
   Directory USER3:[HEXTEN.HTML-TINY-0_905]
   BUILD.PL;1          CHANGES.;1          EXAMPLES.DIR;1      LIB.DIR;1          
   MAKEFILE.PL;1       MANIFEST.;1         META.YML;1          README.;1          
   T.DIR;1             XT.DIR;1            
   Total of 10 files.

Run your tests

Now you can build your module and run the test suite. The VMS equivalent of make is mms. Before using it you need to issue the following command:

   $ set process/parse=extended

If you don't do that you'll have problems because the installed mms is case sensitive but ordinarily command line arguments are upppercased. Once you know how to edit files (see below) you can create a file called login.com in your home directory which contains that command.

Having done that you should be able to:

    $ perl makefile.pl
    Checking if your kit is complete...
    Looks good
    Writing Descrip.MMS for HTML::Tiny
    $ mms     
    cp [.lib.html]tiny.pm [.blib.lib.html]tiny.pm
    cp build.pl [.blib.lib.html]build.pl
    $ mms test
    perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, '[.blib.lib]', '[.blib.arch]')" t/*.t
    t/000-load............
    # Testing HTML::Tiny 0.905
    ok
    t/010-simple..........
    ok
    t/020-coverage........
    ok
    t/030-tags............
    ok
    t/040-lazy............
    ok
    t/050-validate_tag....
    ok
    All tests successful.
    Files=6, Tests=1151,  1 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00 CPU)
    $ 
    

Automating the process

Here's a little chiropractor scottsdale program we use to run the Test::Harness test suite under VMS on a TestDrive box:

   http://svn.hexten.net/tapx/trunk/smoke/testdrive.pl

Create a file called ~/.testdriverc containing your TestDrive credentials:

   user: username
   pass: password

Alter the definition of CLEANUP to match your distribution name and delete the block of code that looks like this (it's specific to Test::Harness):

   print "self test\n";
   my @self_result
     = $t->cmd( qq{perl "-I[.blib.lib]" "-I[.blib.arch]"}
         . qq{ "-MExtUtils::Command::MM" "-e" }
         . qq{"test_harness(0, '[.blib.lib]', '[.blib.arch]')" t/*.t t/compat/*.t}
     );

Then run

   $ perl testdrive.pl My-Distro-Name-0.01.tar.gz

on your local machine. Any previous copies of the distribution will be deleted on the VMS box and the new distro will be uploaded, unpacked, built and tested.

Editing

If your tests all pass then you're done. If they don't pass you'll probably want to do some editing and try again. For small changes it's more convenient to edit directly on VMS.

To edit a file:

   $ edit [.lib.html]tiny.pm

A full screen editor will open and, assuming your terminal settings are sensible, you should be able to move the cursor and perform basic editing.

To save your changes and exit hit F4 for command mode and issue write, then F4 again, then quit. Use the help command to learn more.

Miscellaneous commands

dir
Display the contents of the current directory
set default
Change directory
delete
Delete a file (see below for recursive directory deletion)
rename
Rename a file
help
Learn more about available commands

File and path names

Filenames are case-insensitive. Filenames may only contain a single '.' and have a version suffix:

   LOGIN.COM;1

Unlike Unix the '.' and ';' are formal parts of the filename syntax so to construct a wildcard to match any file in the current directory you'd use

   *.*;*

Directories are normal files with the extension .DIR. A path is a list of directory used cars sacramento names without the .DIR extension separated by dots and enclosed in square brackets. To specify a relative path from the current directory use something like this:

   [.lib.html]tiny.pm

which would be equivalent to lib/html/tiny.pm on Unix. The parent directory is represented as [-] and you change directory using the set default command so

   $ set def [-]

Is the equivalent of

   $ cd ..

(You'll notice that commands can be abbreviated as long as the abbreviation is unambiguous).

Cheating

Sometimes it's easiest to cheat. Experienced VMS users may look away now.

Deleting directories

The official way of recursively deleting a directory tree looks a little forbidding to non-VMSheads. For all I know VMSheads might not like it much either...

The solution (thanks Craig Berry) is to use Perl. Here's how to delete the working directory we created earlier:

   $ dir
   Directory USER3:[HEXTEN]
   HTML-TINY-0_905.DIR;1
   $ perl -e "use File::Path; rmtree(['HTML-TINY-0_905'],1,0);"
   unlink HTML-TINY-0_905/xt/author/pod.t
   ...

Further reading

Thanks

Thanks to Craig Berry and Michael Lemke for advice and tips. Any errors are mine.

Personal tools