tests: Fix clang-analyzer not seeing through `g_error()`

Basically due to the glib structured logging rework we lost the
`noreturn` attribute on `g_error()`.
This is fixed in glib as of f97ff20adf

But we might as well just throw an error here.
This commit is contained in:
Colin Walters 2021-12-21 14:24:03 -05:00
parent 27c14f2be6
commit d2f5a0476f
1 changed files with 4 additions and 4 deletions

View File

@ -80,26 +80,26 @@ run (GError **error)
if (ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, detached_meta_bytes, if (ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, detached_meta_bytes,
OSTREE_REPO_VERIFY_FLAGS_NO_GPG | OSTREE_REPO_VERIFY_FLAGS_NO_SIGNAPI, OSTREE_REPO_VERIFY_FLAGS_NO_GPG | OSTREE_REPO_VERIFY_FLAGS_NO_SIGNAPI,
&verify_report, error)) &verify_report, error))
g_error ("Should not have validated"); return glnx_throw (error, "Should not have validated");
assert_error_contains (error, "No commit verification types enabled"); assert_error_contains (error, "No commit verification types enabled");
// No signatures // No signatures
g_autoptr(GBytes) empty = g_bytes_new_static ("", 0); g_autoptr(GBytes) empty = g_bytes_new_static ("", 0);
if (ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, empty, 0, if (ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, empty, 0,
&verify_report, error)) &verify_report, error))
g_error ("Should not have validated"); return glnx_throw (error, "Should not have validated");
assert_error_contains (error, "no signatures found"); assert_error_contains (error, "no signatures found");
// No such remote // No such remote
if (ostree_repo_signature_verify_commit_data (repo, "nosuchremote", commit_bytes, detached_meta_bytes, 0, if (ostree_repo_signature_verify_commit_data (repo, "nosuchremote", commit_bytes, detached_meta_bytes, 0,
&verify_report, error)) &verify_report, error))
g_error ("Should not have validated"); return glnx_throw (error, "Should not have validated");
assert_error_contains (error, "Remote \"nosuchremote\" not found"); assert_error_contains (error, "Remote \"nosuchremote\" not found");
// Corrupted commit // Corrupted commit
g_autoptr(GBytes) corrupted_commit = corrupt (commit_bytes); g_autoptr(GBytes) corrupted_commit = corrupt (commit_bytes);
if (ostree_repo_signature_verify_commit_data (repo, "origin", corrupted_commit, detached_meta_bytes, 0, if (ostree_repo_signature_verify_commit_data (repo, "origin", corrupted_commit, detached_meta_bytes, 0,
&verify_report, error)) &verify_report, error))
g_error ("Should not have validated"); return glnx_throw (error, "Should not have validated");
assert_error_contains (error, "BAD signature"); assert_error_contains (error, "BAD signature");
return TRUE; return TRUE;