After reading the CUTF posted by x2studios, I remembered a CD utility I wrote a while back. This is a “stress test” designed to keep burning, verifying, and testing the same media.

My initial need was to see if I could in fact reuse the (generic store brand) blank a few hundred times (I quit after 400 and something, figuring I was doing more ware on the drive head than getting more useful info). Also, I found out what proportion of the time failed, to make sure my system’s setting and program parameters were acceptible (e.g. the CD autoplay feature conflicts with the recorder; can I still burn reliably with a load on the server; can I mkisofs over a network).

The CD control is abstracted out from the main logic. It alternates between two different sets of test files, so I am assured that it really was erased and re-recorded, rather than unchanged from the last test (that is, erase failed and then record failed, but verify still passes).

It ejects and reloads after each phase to make sure the verify doesn't just compare against what the OS thinks it just put on the disc, but actually re-reads the disc.

—John

#!perl -w $|=1; use strict; my $num= 0; my $CDRTools_path= 'D:\Program Files\cdrtools'; my $testdata_path1= 'D:\Program Files\cdrtools\testdata'; my $testdata_path2= 'D:\Program Files\cdrtools\testdata2'; my $drive= 'dev=1,4,0'; sub eject () { system "\"$CDRTools_path\\cdrecord.exe\" $drive -eject"; } sub load () { system "\"$CDRTools_path\\cdrecord.exe\" $drive -load"; } sub erase () { system "\"$CDRTools_path\\cdrecord.exe\" $drive -blank=fast -eject sp +eed=2"; } sub record () { my $testdata_path= ($num%2) ? $testdata_path1 : $testdata_path2; chdir $testdata_path; print "\"$CDRTools_path\\mkisofs.exe\" . | \"$CDRTools_path\\cdrecord +.exe\" $drive -eject -fs8m speed=2" , "\n"; system 'D:\work\dev\experiment\CDRW\helper.bat'; } sub compare () { my $testdata_path= ($num%2) ? $testdata_path1 : $testdata_path2; chdir $testdata_path; system "fc /b \"*\" \"h:\\*\""; } ############ one pass sub trial { print "====== Eject tray ========\n\n"; eject; print "====== Load tray ========\n\n"; load; print "====== Erase Old Contents ========\n\n"; erase; #includes eject print "====== Load Tray ========\n\n"; load; print "====== Record On Disc ========\n\n"; record; #includes eject load; compare; } ############ main program for (;;) { ++$num; print "\n####################\n## Test number $num\n############## +######\n\n"; trial; }

Replies are listed 'Best First'.
Re: Stress test CDRW
by Beatnik (Parson) on Jun 18, 2001 at 11:13 UTC
    Just like x2studios you're not checking return code for your system calls...

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.
      The entire output of the system call is being logged to stderr/stdout, and I later inspect the error messages.