#include "sd-journal.h"
#include "alloc-util.h"
+#include "chattr-util.h"
#include "journal-file.h"
#include "journal-internal.h"
#include "macro.h"
int r;
assert_se(mkdtemp(dn));
+ (void) chattr_path(dn, FS_NOCOW_FL, FS_NOCOW_FL, NULL);
+
fn = strappend(dn, "/test.journal");
r = journal_file_open(-1, fn, O_CREAT|O_RDWR, 0644, false, 0, false, NULL, NULL, NULL, NULL, &new_journal);
#include "sd-journal.h"
+#include "chattr-util.h"
#include "log.h"
#include "parse-util.h"
#include "rm-rf.h"
int main(int argc, char *argv[]) {
sd_journal *j;
int r, i, I = 100;
- char t[] = "/tmp/journal-stream-XXXXXX";
+ char t[] = "/var/tmp/journal-stream-XXXXXX";
test_setup_logging(LOG_DEBUG);
log_info("Running %d loops", I);
assert_se(mkdtemp(t));
+ (void) chattr_path(t, FS_NOCOW_FL, FS_NOCOW_FL, NULL);
for (i = 0; i < I; i++) {
r = sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY);
#include "sd-journal.h"
#include "alloc-util.h"
+#include "chattr-util.h"
#include "io-util.h"
#include "journal-file.h"
#include "journal-vacuum.h"
test_close(two);
}
+static void mkdtemp_chdir_chattr(char *path) {
+ assert_se(mkdtemp(path));
+ assert_se(chdir(path) >= 0);
+
+ /* Speed up things a bit on btrfs, ensuring that CoW is turned off for all files created in our
+ * directory during the test run */
+ (void) chattr_path(path, FS_NOCOW_FL, FS_NOCOW_FL, NULL);
+}
+
static void test_skip(void (*setup)(void)) {
- char t[] = "/tmp/journal-skip-XXXXXX";
+ char t[] = "/var/tmp/journal-skip-XXXXXX";
sd_journal *j;
int r;
- assert_se(mkdtemp(t));
- assert_se(chdir(t) >= 0);
+ mkdtemp_chdir_chattr(t);
setup();
static void test_sequence_numbers(void) {
- char t[] = "/tmp/journal-seq-XXXXXX";
+ char t[] = "/var/tmp/journal-seq-XXXXXX";
JournalFile *one, *two;
uint64_t seqnum = 0;
sd_id128_t seqnum_id;
- assert_se(mkdtemp(t));
- assert_se(chdir(t) >= 0);
+ mkdtemp_chdir_chattr(t);
assert_se(journal_file_open(-1, "one.journal", O_RDWR|O_CREAT, 0644,
true, (uint64_t) -1, false, NULL, NULL, NULL, NULL, &one) == 0);
#include "sd-journal.h"
#include "alloc-util.h"
+#include "chattr-util.h"
#include "journal-file.h"
#include "journal-internal.h"
#include "log.h"
int main(int argc, char *argv[]) {
JournalFile *one, *two, *three;
- char t[] = "/tmp/journal-stream-XXXXXX";
+ char t[] = "/var/tmp/journal-stream-XXXXXX";
unsigned i;
_cleanup_(sd_journal_closep) sd_journal *j = NULL;
char *z;
assert_se(mkdtemp(t));
assert_se(chdir(t) >= 0);
+ (void) chattr_path(t, FS_NOCOW_FL, FS_NOCOW_FL, NULL);
assert_se(journal_file_open(-1, "one.journal", O_RDWR|O_CREAT, 0666, true, (uint64_t) -1, false, NULL, NULL, NULL, NULL, &one) == 0);
assert_se(journal_file_open(-1, "two.journal", O_RDWR|O_CREAT, 0666, true, (uint64_t) -1, false, NULL, NULL, NULL, NULL, &two) == 0);
#include <stdio.h>
#include <unistd.h>
+#include "chattr-util.h"
#include "fd-util.h"
#include "io-util.h"
#include "journal-file.h"
}
int main(int argc, char *argv[]) {
- char t[] = "/tmp/journal-XXXXXX";
+ char t[] = "/var/tmp/journal-XXXXXX";
unsigned n;
JournalFile *f;
const char *verification_key = argv[1];
assert_se(mkdtemp(t));
assert_se(chdir(t) >= 0);
+ (void) chattr_path(t, FS_NOCOW_FL, FS_NOCOW_FL, NULL);
log_info("Generating...");
#include <fcntl.h>
#include <unistd.h>
+#include "chattr-util.h"
#include "io-util.h"
#include "journal-authenticate.h"
#include "journal-file.h"
static bool arg_keep = false;
+static void mkdtemp_chdir_chattr(char *path) {
+ assert_se(mkdtemp(path));
+ assert_se(chdir(path) >= 0);
+
+ /* Speed up things a bit on btrfs, ensuring that CoW is turned off for all files created in our
+ * directory during the test run */
+ (void) chattr_path(path, FS_NOCOW_FL, FS_NOCOW_FL, NULL);
+}
+
static void test_non_empty(void) {
dual_timestamp ts;
JournalFile *f;
Object *o;
uint64_t p;
sd_id128_t fake_boot_id;
- char t[] = "/tmp/journal-XXXXXX";
+ char t[] = "/var/tmp/journal-XXXXXX";
test_setup_logging(LOG_DEBUG);
- assert_se(mkdtemp(t));
- assert_se(chdir(t) >= 0);
+ mkdtemp_chdir_chattr(t);
assert_se(journal_file_open(-1, "test.journal", O_RDWR|O_CREAT, 0666, true, (uint64_t) -1, true, NULL, NULL, NULL, NULL, &f) == 0);
static void test_empty(void) {
JournalFile *f1, *f2, *f3, *f4;
- char t[] = "/tmp/journal-XXXXXX";
+ char t[] = "/var/tmp/journal-XXXXXX";
test_setup_logging(LOG_DEBUG);
- assert_se(mkdtemp(t));
- assert_se(chdir(t) >= 0);
+ mkdtemp_chdir_chattr(t);
assert_se(journal_file_open(-1, "test.journal", O_RDWR|O_CREAT, 0666, false, (uint64_t) -1, false, NULL, NULL, NULL, NULL, &f1) == 0);
struct iovec iovec;
Object *o;
uint64_t p;
- char t[] = "/tmp/journal-XXXXXX";
+ char t[] = "/var/tmp/journal-XXXXXX";
char data[2048] = {0};
bool is_compressed;
int r;
test_setup_logging(LOG_DEBUG);
- assert_se(mkdtemp(t));
- assert_se(chdir(t) >= 0);
+ mkdtemp_chdir_chattr(t);
assert_se(journal_file_open(-1, "test.journal", O_RDWR|O_CREAT, 0666, true, compress_threshold, true, NULL, NULL, NULL, NULL, &f) == 0);