For my Raspberry Pi build/test automation regimen, there are two aspects of code that require root permissions, as they will not work with /dev/gpiomem (fwiw, one aspect is Pulse-Width Modulation functionality, the other deals with the Pi's hardware clock registers).
I obviously don't want to have the actual code up and randomly sudo, instead, a note in the docs will specify if these features are used, you'll need to setuid or run your script with sudo.
Likewise, I don't want to run the whole test suite with root, just two files.
I'm thinking something like the following which appears to work well:
use warnings; use strict; use Test::More; if ($> != 0){ system('sudo', 'prove', '-l', $0); exit; } is 1, 1, "ok"; done_testing();
Is this reasonable, or am I overlooking an easier or better way to do this?
In reply to Running specific test files with sudo by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |