summaryrefslogtreecommitdiff
path: root/test/format/backup.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/format/backup.c')
-rw-r--r--test/format/backup.c55
1 files changed, 26 insertions, 29 deletions
diff --git a/test/format/backup.c b/test/format/backup.c
index 748494bf841..2b1463bd0e3 100644
--- a/test/format/backup.c
+++ b/test/format/backup.c
@@ -37,20 +37,18 @@ check_copy(void)
{
WT_CONNECTION *conn;
WT_SESSION *session;
- int ret;
wts_open(g.home_backup, 0, &conn);
- if ((ret = conn->open_session(
- conn, NULL, NULL, &session)) != 0)
- die(ret, "connection.open_session: %s", g.home_backup);
+ testutil_checkfmt(
+ conn->open_session(conn, NULL, NULL, &session),
+ "%s", g.home_backup);
- ret = session->verify(session, g.uri, NULL);
- if (ret != 0)
- die(ret, "session.verify: %s: %s", g.home_backup, g.uri);
+ testutil_checkfmt(
+ session->verify(session, g.uri, NULL),
+ "%s: %s", g.home_backup, g.uri);
- if ((ret = conn->close(conn, NULL)) != 0)
- die(ret, "connection.close: %s", g.home_backup);
+ testutil_checkfmt(conn->close(conn, NULL), "%s", g.home_backup);
}
/*
@@ -62,14 +60,19 @@ copy_file(const char *name)
{
size_t len;
char *cmd;
- int ret;
len = strlen(g.home) + strlen(g.home_backup) + strlen(name) * 2 + 20;
cmd = dmalloc(len);
(void)snprintf(cmd, len,
"cp %s/%s %s/%s", g.home, name, g.home_backup, name);
- if ((ret = system(cmd)) != 0)
- die(ret, "backup copy: %s", cmd);
+ testutil_checkfmt(system(cmd), "backup copy: %s", cmd);
+ free(cmd);
+
+ len = strlen(g.home) + strlen(g.home_backup2) + strlen(name) * 2 + 20;
+ cmd = dmalloc(len);
+ (void)snprintf(cmd, len,
+ "cp %s/%s %s/%s", g.home, name, g.home_backup2, name);
+ testutil_checkfmt(system(cmd), "backup copy: %s", cmd);
free(cmd);
}
@@ -96,8 +99,7 @@ backup(void *arg)
return (NULL);
/* Open a session. */
- if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
- die(ret, "connection.open_session");
+ testutil_check(conn->open_session(conn, NULL, NULL, &session));
/*
* Perform a backup at somewhere under 10 seconds (so we get at
@@ -113,12 +115,12 @@ backup(void *arg)
break;
/* Lock out named checkpoints */
- if ((ret = pthread_rwlock_wrlock(&g.backup_lock)) != 0)
- die(ret, "pthread_rwlock_wrlock: backup lock");
+ testutil_check(pthread_rwlock_wrlock(&g.backup_lock));
/* Re-create the backup directory. */
- if ((ret = system(g.home_backup_init)) != 0)
- die(ret, "backup directory creation failed");
+ testutil_checkfmt(
+ system(g.home_backup_init),
+ "%s", "backup directory creation failed");
/*
* open_cursor can return EBUSY if a metadata operation is
@@ -128,26 +130,21 @@ backup(void *arg)
"backup:", NULL, NULL, &backup_cursor)) == EBUSY)
sleep(1);
if (ret != 0)
- die(ret, "session.open_cursor: backup");
+ testutil_die(ret, "session.open_cursor: backup");
while ((ret = backup_cursor->next(backup_cursor)) == 0) {
- if ((ret =
- backup_cursor->get_key(backup_cursor, &key)) != 0)
- die(ret, "cursor.get_key");
+ testutil_check(
+ backup_cursor->get_key(backup_cursor, &key));
copy_file(key);
}
- if ((ret = backup_cursor->close(backup_cursor)) != 0)
- die(ret, "cursor.close");
-
- if ((ret = pthread_rwlock_unlock(&g.backup_lock)) != 0)
- die(ret, "pthread_rwlock_unlock: backup lock");
+ testutil_check(backup_cursor->close(backup_cursor));
+ testutil_check(pthread_rwlock_unlock(&g.backup_lock));
check_copy();
}
- if ((ret = session->close(session, NULL)) != 0)
- die(ret, "session.close");
+ testutil_check(session->close(session, NULL));
return (NULL);
}