CheckType parameters for processing XUnit test results

A Jenkins pipeline can publish XUnit test results as a step in a Jenkinsfile. Being unable to find any online documentation for the XUnitBuilder CheckType parameters, I dug into the code myself to find the answers.

Here’s a full XUnitBuilder stanza like that generated from the Jenkins Pipeline Snippet Generator (with the lines wrapped):

step([$class: 'XUnitBuilder',
     testTimeMargin: '3000',
     thresholdMode: 1,
     thresholds: [
       [$class: 'FailedThreshold',
         failureNewThreshold: '',
         failureThreshold: '',
         unstableNewThreshold: '',
         unstableThreshold: ''],
       [$class: 'SkippedThreshold',
         failureNewThreshold: '',
         failureThreshold: '',
         unstableNewThreshold: '',
         unstableThreshold: '']
     ],
     tools: [
       [$class: 'CheckType',
         deleteOutputFiles: false,
         failIfNotNew: false,
         pattern: '**/unittests.xml',
         skipNoTestFiles: false,
         stopProcessingIfError: true]
     ]
])

Here are the CheckType parameters and what they mean:

  • deleteOutputFiles – If true, the output files are deleted after being processed. If false they are left in-place. Default: false.
  • failIfNotNew – If true and files match the pattern but were not updated in the last build, the check fails. This helps ensure that all tests were run. Default: false.
  • pattern – File pattern that identifies XUnit-formatted output.
  • skipNoTestFiles – If true and no test files matching pattern are found, the check is skipped. If false and no tests are found the check fails. Default: false.
  • stopProcessingIfError – If true, any error (such as an empty result file) will stop any further processing. If false, errors will be reported but processing will continue. Default: true.

Note that you can get by with a much smaller step stanza by just including values that differ from the defaults, eg:

step([$class: 'XUnitBuilder',
     tools: [
       [$class: 'CheckType',
         pattern: '**/unittests.xml',
         skipNoTestFiles: true]
     ]
])

 

Installing yaz for PHP on Ubuntu

Numerous sites on the internet have answered the basic question of “how do I install yaz for PHP on Ubuntu”. Which basically boils down to:

sudo apt-get install yaz
sudo apt-get install pecl
sudo pecl install yaz

Then add the following line to /etc/php5/apache2/php.ini:

extension=yaz.so

Sadly, the pecl install will fail with the error:

checking for yaz-config... NONE
configure: error: YAZ not found (missing NONE)
ERROR: `/tmp/pear/temp/yaz/configure --with-yaz' failed

All the search results for this error solve it by downloading the yaz source code and compiling and installing it outside the package manager, which is non-ideal.

The missing piece is that yaz-config is included with the libyaz4-dev package:

sudo apt-get install libyaz4-dev

Interestingly, this yaz install blog post does explicitly calls out the need for the -dev packages, but doesn’t include the error when you don’t have it. Hopefully this blog post will tie the two bits together for future people perplexed by this.

Decreasing bitmap resolution when exporting PDFs in Inkscape

When exporting a document with bitmap images in it, Inkscape won’t downsample them to a lower resolution, despite the “Resolution for rasterization (dpi)” setting in the PDF export dialog. That export dialog setting only applies to bitmaps that have had filters applied against them. See bug 246677.

4 years ago I figured out how to work around this and today I had to relearn it. So as to not repeat this in another 4 years, I’m documenting this here for posterity.

The workaround is to apply an identity filter to each bitmap before saving it. An identity filter is one that doesn’t do anything, but because it is a filter it forces Inkscape to do the downsampling upon export. Because an identity filter doesn’t actually do anything, there isn’t one available in the Filters menu, but we can create one.

To create a reusable identity filter:

  1. Open a new Inkscape file
  2. From the Filters menu, select Filter Editor…
  3. In the Filter Editor pane, click the New button. This will add the filter “filter1” to the Filter list
  4. Double click “filter1” and rename it “Identity”
  5. To the right of the Add Effect: button there is a drop-down. Change it to Color Matrix, and hit the Add Effect: button
  6. Save the document as “Identity filter.svg”
  7. Now put the file where Inkscape can find it:
    • Linux/OS X: ~/.config/inkscape/filters
    • Windows XP: C:\Documents and Settings\[USERNAME]\Application Data\Inkscape\filters
    • Windows Vista and later: C:\Users\[USERNAME]\AppData\Roaming\Inkscape\filters
  8. The ‘filters’ directory may not exist, in which case just create it.
  9. Close and restart Inkscape
  10. This should add the Personal submenu under the Filters menu which should include our Identity filter.

To use the identity filter:

  1. In your Inkscape file, select the bitmaps you want to downsample. Be sure not to select any vector images or text since you don’t want to rasterize that.
  2. From the Filters menu, select Personal > Identity
  3. Now when you save the document as a PDF, adjust the “Resolution for rasterization (dpi)” setting. 90 is a decent number for documents that are being viewed on a computer screen. 150 is probably the smallest you want to go for anything that is being printed.

O_SYNC, where has thy FILE_SYNC gone?

This morning I came across an interesting difference between RHEL 5 and RHEL 6 (and of course their CentOS brethren).

In the RHEL 5 kernel, when an application writes to a file opened with O_SYNC over NFS, those writes come across the wire as FILE_SYNC writes — ie: stable.

In the RHEL 6 kernel, when an application writes to a file opened with O_SYNC over NFS, those writes come across as UNSTABLE immediately followed by a COMMIT. To get the writes to come across the wire as FILE_SYNC, you have to use the O_DIRECT flag (either by itself or in addition to the O_SYNC flag).

This is a rather significant change and has storage-system impacts. Good for both users and implementers to be aware of.

Update: According to this kernel bug the RHEL 6 behavior listed above happens in kernels 2.6.32 to 2.6.38-rc3. Presumably it is fixed (ie: reverted to the RHEL 5 behavior) after 2.6.38-rc3, although I don’t know if its been picked up in the RHEL kernel.

Evolution of Gnome 3 to a flavor of Cinnamon

I want to be on a more recent version of Linux on my desktop here at the office. My Fedora 14 install is getting long in the tooth — particularly in Evolution. In fact, running a more recent version of Evolution is one of my primary reasons of wanting to upgrade: I’m hoping they’ve polished the Exchange integration a bit more.

The problem with Fedora 15 and 16 is the introduction of Gnome 3 and the Gnome Shell, where the Gnome developers decided to dumb-down the shell even further than they did back in Gnome 2. I don’t want it. Lots of people don’t want it.

But that’s ok, because it’s Linux (unlike Microsoft users who are stuck with whatever Redmond gives them — better hope you like Metro!). Cinnamon offers all of the great infrastructure that Gnome 3 provides with the Gnome 2-like interface that people actually like.

So off I go installing Fedora 16 within a VM only to discover that Gnome 3 requires hardware acceleration and VMware doesn’t support hardware acceleration for Linux guests. This means I can’t test out Cinnamon, or even Gnome 3, in a VM before jumping ship.

And so this endeavor comes to a close almost before it got started. With luck maybe VM will start supporting 3D acceleration in Linux sometime soon ’cause I want to play with Gnome 3 and Cinnamon before taking the plunge.

Amazon MP3 Downloader for Fedora 14? Nah, go clamz

I remember futzing for hours a year ago trying to get the Amazon MP3 Downloader (amazonmp3) working on my Fedora 12 (or 13?) instance. I eventually got it working but it’s a pain because the Fedora 11 binary Amazon provides requires a libboost version that isn’t provided with modern Fedora releases.

Now, however, there’s an opensource implementation: clamz. It’s available in most repositories (Fedora 14 for instance). Opening an .amz file will start clamz and download the music to $HOMEDIR/Music by default (you can customize this and more by editing $HOMEDIR/.clamz/config). In other words: it just works.

Getting seahorse to recognize existing SSH keys

I had a doozie of a time getting seahorse (aka: Gnome’s “Passwords and Encryption Keys” program) to recognize my personal SSH keys. The start of the problem was that I’d SSHd my private key (id_rsa) over to the box, but not the public key (id_rsa.pub) which seahorse needs. Not a problem, ssh-keygen -e convienently outputted the public key to the screen which I shoved into id_rsa.pub. The problem was that the key was in the wrong format for seahorse. It looked like this

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "2048-bit RSA, converted by cpeel from "
AAAAB3NzaC1yc2EAAAABIwAAAQEApTseuoEnUBPIQSLWjOnXY6m4idRLJ+WE49/ov0VA5/
S8+fRHosP7WrBnrja8GLqd9jiG3HOSoFT4BgQ1kBJvyKLg88Kyt5V83dmhWhr2TzWHVeo7
gtOmN0pNT7Xl3dxChLvM1LoAolif9PXLTs81CFwUTCWd+DPMa4SX7Ti8MUscy6YNkyB74A
lsbLM/0JEvBSZd+72ZJlG1laKlt8adcp2EXngnqQn0r9d5ws5kF1J3BbkKtKClssuBSsFR
Bckn7xlnXlO8o6lsq/j9cwpGYAoVy+gE/ZaVNUwG4wvZ9hlqY1sWqo9r9R9KjyVkIdXq0V
IxYCudxLYyEtf30pKrGw==
---- END SSH2 PUBLIC KEY ----

instead of looking like

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEApTseuoEnUBPIQSLWjOnXY6m4idRLJ+WE49/ov0VA5/S8+fRHosP7WrBnrja8GLqd9jiG3HOSoFT4BgQ1kBJvyKLg88Kyt5V83dmhWhr2TzWHVeo7gtOmN0pNT7Xl3dxChLvM1LoAolif9PXLTs81CFwUTCWd+DPMa4SX7Ti8MUscy6YNkyB74AlsbLM/0JEvBSZd+72ZJlG1laKlt8adcp2EXngnqQn0r9d5ws5kF1J3BbkKtKClssuBSsFRBckn7xlnXlO8o6lsq/j9cwpGYAoVy+gE/ZaVNUwG4wvZ9hlqY1sWqo9r9R9KjyVkIdXq0VIxYCudxLYyEtf30pKrGw== cpeel

(that’s all suppose to be on one line).

A simple massaging and seahorse was happy with it.