---
name: "dh_elpa_test"
section: "1"
platform: "linux"
package: "dh-elpa"
version: "2.1.9"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/dh_elpa_test"
---

# dh\_elpa\_test(1)

run ELPA package testsuites

## NAME

dh\_elpa\_test - run ELPA package testsuites

## SYNOPSIS

**dh\_elpa\_test** \[*debhelper options*\] \[*--autopkgtest*\] \[*pkg-file*\]

## DESCRIPTION

**dh\_elpa\_test** is a debhelper program that is responsible for running the testsuites of ELPA packages, when those test suites use ERT or [**buttercup**(1)](/buttercup/1.md).  [**dh\_auto\_test**(1)](/dh_auto_test/1.md) is rarely suitable.

Testing with [**buttercup**(1)](/buttercup/1.md) will be activated if the package build-depends on elpa-buttercup.  Testing with ERT will be activated if ERT test files can be found.  Neither kind of test will be activated unless the debhelper compat level is 10 or higher.

**dh\_elpa\_test** overrides [**dh\_auto\_test**(1)](/dh_auto_test/1.md).  If you need to switch back to use [**dh\_auto\_test**(1)](/dh_auto_test/1.md), use the **disable** configuration key, below.

## FILES

- debian/elpa-test

  Configuration for running the package's test suite.  Each line is of the form *key* = *value*, with *key* drawn from the list of configuration options below.

  Note that you should not surround values with double quotation marks. This is convenient for including lisp.  Configuration values cannot cover more than one line.  Lines preceded with a # are ignored as comments.

  This configuration file is optional; in many cases, **dh\_elpa\_test** can figure out how to run the test suite itself.

## CONFIGURATION KEYS

- **disable**

  If this key is set to any value, [**dh\_elpa**(1)](/dh_elpa/1.md) will not invoke **dh\_elpa\_test**.

- **buttercup\_load\_path**

  A comma-separated list of directories to add to the load-path when [**buttercup**(1)](/buttercup/1.md) invokes Emacs.  Will be passed to [**buttercup**(1)](/buttercup/1.md) with its **-L** command line argument.

- **buttercup\_patterns**

  A comma-separated list of Emacs regular expressions jointly matching all and only the files containing Buttercup tests that you wish to run.  If this key is not defined, all tests that can be found will be run.  Will be passed to [**buttercup**(1)](/buttercup/1.md) with its **-p** command line argument.

- **ert\_exclude**

  A comma-separated list of file globs matching files containing ERT tests that should not be run.

  The '\*' character in globs in this configuration key does NOT match '/' directory separators.

- **ert\_helper**

  The name of a \*.el file containing Emacs Lisp code that will run the ERT test suite.  When this key is not defined, **dh\_elpa\_test** calls the function **(ert-run-tests-batch-and-exit)**.

  Your helper code should ensure that Emacs exits nonzero if there were any test failures, or exits zero if the test suite passed.

  Note that this is not the way to load test helpers that do needed work but don't actually run the tests.  For that, you can use something like

  ```
      ert_eval = (load-file "test-helper.el")
  ```

- **ert\_eval**

  Emacs Lisp code to be run prior to running ERT tests by the Emacs instance spawned by **dh\_elpa\_test** to run those tests.

- **ert\_load\_path**

  A comma-separated list of directories to add to the load-path when **dh\_elpa\_test** invokes Emacs to run ERT tests.

- **ert\_selectors**

  A Lisp expression specifying a set of tests.  This is the same as ERT test selectors and will be passed to ERT through command line.  Note that this is disabled when **ert\_eval** is specified, and you'll have to manually specify the selectors in the helper script.

- **autopkgtest\_keep**

  A comma-separated list of file globs matching files that should not be moved out of the source tree before running DEP8 tests (see the **--autopkgtest** option below).

  The '\*' character in globs in this configuration key matches '/' directory separators.

## OPTIONS

- **--autopkgtest**

  Operate in autopkgtest mode.  **dh\_elpa\_test** will rename non-test \*.el files so that Emacs will not load them.  This ensures that the test test the installed binary package rather than the unpacked source package.

  To exclude files from this removal, specify them in the **autopkgtest\_keep** configuration option (see above).

## ENVIRONMENT VARIABLES

Older versions of **dh\_elpa\_test** were configured using environment variables corresponding to some of the above configuration keys.  For example, the **ert\_eval** configuration key replaced environment variable **DH\_ELPA\_TEST\_ERT\_EVAL**.  Their use is now deprecated.  If the debian/elpa-test file exists, they will be ignored.

## CONTROLLING INVOCATION

The following recipes can be combined to enable an appropriate combination of build time and autopkgtest time tests.

### DISABLING BUILD TIME TESTS

To disable running tests at build time, you have two choices. You can override **dh\_elpa\_test** (not **dh\_auto\_test**), or you can use the **disable** key in **debian/elpa-test**. Note that the latter will also (mostly) disable autopkgtests (see below).

### ENABLING AUTOPKGTESTS

To enable running autopkgtests via **dh\_elpa\_test**, add "Testsuite: autpkgtest-pkg-elpa" to **debian/control**.  With **disable** in **debian/elpa-test**, only **superficial** tests, namely installing the binary packages and byte-compiling any that use **dh\_elpa**.

### ENABLING DH\_AUTO\_TEST

By default **dh\_elpa\_test** replaces **dh\_auto\_test**. You can re-enable **dh\_auto\_test** either with the **disable** key discussed above, or by overriding **dh\_elpa\_test** to call **dh\_auto\_test**.
