Building and testing udev
From Crashcourse Wiki
Contents |
[edit] Overview
The Linux udev utility is confusing enough as it is, but it turns out that the source comes with a "test" component that doesn't seem to appear in the standard distro-specific packages, so here's my brief adventure in downloading, building and testing it.
Since this is on my current Ubuntu 10.04 system on which I've already installed a number of development packages, you might have to do that as well as you follow along. Send feedback to rpjday@crashcourse.ca.
[edit] Git the source
Starting from the main udev page [here] if you want to do some reading first, just:
$ git clone git://git.kernel.org/pub/scm/linux/hotplug/udev.git git
[edit] Required packages
Since the autogen.sh script calls gtkdocize:
$ sudo apt-get install gtk-doc-tools
[edit] Configuration
Based on the way my system is currently configured, I needed to run:
$ ./autogen.sh \ --without-selinux \ --disable-extras \ --disable-introspection $
Feel free to play with those options.
[edit] The build
$ make
Works for me. But, wait, we're not done, because here's the best part and what we've been leading up to.
[edit] Running the udev test suite
Assuming everything built in the last step, you can build the test utility:
$ make udev/test-udev CC udev/test-udev.o CCLD udev/test-udev $
at which point you can now run the test suite, which simulates the insertion and removal of a number of devices, and checks the output for correctness. Because this is Ubuntu and you'll most likely be using sudo, you have to remember to preserve the initial environment; otherwise, the $PWD variable will be empty and bad things will happen. So:
$ sudo -E perl test/udev-test.pl udev-test will run 142 tests: TEST 1: no rules device '/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda' expecting node/link 'sda' add: ok remove: error as expected TEST 2: label test of scsi disc device '/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda' expecting node/link 'boot_disk' add: ok remove: ok ... snip ... 0 errors occured
Nifty, no?

