repo: Add OSTREE_REPO_TEST_ERROR=pre-commit env var

Setting this causes commit to error out.  There are other ways we
could do this in a more sophisticated fashion, such as via SystemTap
etc.  But this has low-tech applicablity, works as non-root.

The reason I'm adding this is so that we can add test cases for
cleanup of the `tmp/staging-` directory.

Closes: #170
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Colin Walters (automation) committed 2016-05-02 18:44:44 +00:00
1 parent 3111248373
commit 15b3cab65e
4 files changed
+29 -1

No files matched your search

+6
View File
@@ -798,6 +798,9 @@ ostree_repo_init (OstreeRepo *self)
{
static gsize gpgme_initialized;
GLnxLockFile empty_lockfile = GLNX_LOCK_FILE_INIT;
const GDebugKey test_error_keys[] = {
{ "pre-commit", OSTREE_REPO_TEST_ERROR_PRE_COMMIT },
};
if (g_once_init_enter (&gpgme_initialized))
{
@@ -806,6 +809,9 @@ ostree_repo_init (OstreeRepo *self)
g_once_init_leave (&gpgme_initialized, 1);
}
self->test_error_flags = g_parse_debug_string (g_getenv ("OSTREE_REPO_TEST_ERROR"),
test_error_keys, G_N_ELEMENTS (test_error_keys));
g_mutex_init (&self->cache_lock);
g_mutex_init (&self->txn_stats_lock);