Smoking Perl
Sawyer X's March 5-25 2018 Perl 5 Porters Mailing list summary put out a call for macOS smoke testers. I thought I would see how far I could get putting one together from the Test-Smoke docs.
The following is not a blow-by-blow (painful and uninteresting to
read), but rather what I came up with after a few false starts,
with emphasis on what I did over and above the Test-Smoke
README
documentation, and (sometimes) why.
Environment:
- macOS 10.13 High Sierra
- Custom-built Perl installed system-wide in custom directory
- CPAN client (not cpanp or cpanm) configured to
sudo
Procedure:
- Install Test::Smoke. I chose a directory that was not
backed up by Time Machine. I used
~/Nobackup/perl/Test-Smoke-1.72/smoke
. The default install is under~/.cpan/
, but I thought I wanted the smoker to be a little more visible. TheTest-Smoke-1.72/
is because trial-and-error showed that the configuration script wants to put the Perl Git repository and build directories in siblings tosmoke/
, and I wanted everything related to the smoker to be in a directory by itself. Note that there is nothing magic about theNobackup/
directory name; it is not backed up because I configured Time Machine not to back it up. - Because my CPAN client uses
sudo
to install, thesmoke/
directory and its contents were owned byroot
, so I had tosudo chown -R
back to myself. cd ~/Nobackup/perl/Test-Smoke-1.72/smoke
- I wanted to smoke the current Perl. Trial and error showed
that the configuration script wanted to modify
perlcurrent.cfg
. That file turned out to be read-only, and was found inlib/Test/Smoke/
. I copied it to./
, and did achmod u+w
on it. perl configsmoke.pl
. I chose to smokeblead
(the default), and took the default for all remaining questions. Note that we need to handle scheduling separately since macOS does not usecrontab
.- Put contact information in
smokecurrent.usernote
. I do not know if that is the intended use of this file, but I also did not see any other place to specify this, and I wanted people to be able to reach me if something screwed up. - Ran
time ./smokecurrent.sh
, just to see if anything useful would happen, and if so what, and how long it would take. It took 5 hours, and somewhat to my surprise showed up as a "pass" at perl5.test-smoke.org/. - MacOS has
consolidated a number of functions into a process called
launchd
. The consolidated functionality includesinit
,cron
, andinetd
. In order to get something scheduled bylaunchd
I wrote alaunchd.plist (5)
file, which needs to be put in~/Library/LaunchAgents/
. I am still tweaking this, but the current version is here. Tweaks you may need or want are:- Change the <Label> value to something you like. The name of the file should be this value, with ".plist" appended.
- Change the path to
smokecurrent.sh
to the appropriate value for your installation. - The <WorkingDirectory> entry may be unneeded, because
the first thing
smokecurrent.sh
does is tocd
to the correct directory. - Maybe the value of <ProcessType> should be
Background
. I had it there once and got a FAIL(X), which I did not understand. I thought it might be a timing issue, so I decided to play it safe until I knew I had a working smoker.
launchctl load ~/Library/LaunchAgents/your-plist-file.plist
- In addition, you may want to go into the "Power" setting and tell your CPU not to go to sleep, at least during times your smoker is scheduled to run.
Instead of reading the docs, I started by installing Test::Smoke. It turns out that installing it also configures it and also automatically added a line to my crontab after asking for permission.
I went through the same process. It looks complicated but it is very simple. I used cron though sinceI don't care about jobs that I might have missed (which launchd is smart about).
I modified my cron command to set LOGNAME to use the name I want to use to identify myself instead of the actual login name on my machine.
I have a patched version of Test::Smoke that lets me use HOSTNAME to set something more meaningful instead of the actual hostname of the machine. I set this to the Mac model number (like MacPro4,1).
For a long time I put this off because I thought I'd have to configure email. Test::Smoke can also submit with HTTP::Tiny though so I never touched anything with email.
The smoking takes several hours, but it compiles and tests several different configurations (around 16 combinations I think).
The results are at http://perl5.test-smoke.org.
I was eventually going to make the same post. Now I don't have to!
Mail was my biggest doubt too. I used to be a desultory CPAN tester, but gave it up a few years back when it became impossible for me to inject mail into their system. I hope things are better now, but have not gone back to see.
I took the default mailer (
/usr/bin/mail
), but while things were running I used it to send myself a message. This never arrived at my ISP, so I expected nothing to show up at perl5.test-smoke.org either. But it did. My conclusion is that it was surprisingly easy, though not quite trivial.Thanks for writing up that step-by-step guide. Once I saw it was really quite simple to do, it was the nudge that got me to do what I'd always intended to do someday, start smoking...