diff --git a/var/spack/repos/builtin/packages/patchelf/package.py b/var/spack/repos/builtin/packages/patchelf/package.py
index d17bb3bea184f8a0593f025f9ac5707798454ebb..8ddb7693e1dd64a61bcee0bdc854a6449c9ec8ec 100644
--- a/var/spack/repos/builtin/packages/patchelf/package.py
+++ b/var/spack/repos/builtin/packages/patchelf/package.py
@@ -5,6 +5,12 @@
 
 from spack import *
 
+import os
+import shutil
+import tempfile
+
+import llnl.util.tty as tty
+
 
 class Patchelf(AutotoolsPackage):
     """PatchELF is a small utility to modify the dynamic linker and RPATH of
@@ -18,3 +24,23 @@ class Patchelf(AutotoolsPackage):
     version('0.10', sha256='b2deabce05c34ce98558c0efb965f209de592197b2c88e930298d740ead09019')
     version('0.9',  sha256='f2aa40a6148cb3b0ca807a1bf836b081793e55ec9e5540a5356d800132be7e0a')
     version('0.8',  sha256='14af06a2da688d577d64ff8dac065bb8903bbffbe01d30c62df7af9bf4ce72fe')
+
+    def test(self):
+        patchelf = which('patchelf')
+        assert patchelf is not None
+
+        tty.msg('test: Ensuring use of the installed executable')
+        patchelf_dir = os.path.dirname(patchelf.path)
+        assert patchelf_dir == self.prefix.bin
+
+        tty.msg('test: Checking version')
+        output = patchelf('--version', output=str.split, error=str.split)
+        assert output.strip() == 'patchelf {0}'.format(self.spec.version)
+
+        tty.msg('test: Ensuring the rpath is changed')
+        currdir = os.getcwd()
+        hello_fn = os.path.join(currdir, 'data', 'hello')
+        patchelf('--set-rpath', currdir, hello_fn)
+        output = patchelf('--print-rpath', hello_fn,
+                          output=str.split, error=str.split)
+        assert output.strip() == currdir
diff --git a/var/spack/repos/builtin/packages/patchelf/test/hello b/var/spack/repos/builtin/packages/patchelf/test/hello
new file mode 100755
index 0000000000000000000000000000000000000000..8767836f8e8a3268b03cf29c771d8c019b8353b3
Binary files /dev/null and b/var/spack/repos/builtin/packages/patchelf/test/hello differ