9 #define GNUPG_DIR ".gnupg"
12 #define mkdir(x,y) mkdir(x)
15 static int test_setup_gnupg(void) {
16 char *home
, *path
= NULL
;
17 char tmpfile
[] = "XXXXXX";
20 home
= getenv("HOME");
22 FAIL_TEST("Could not get HOME variable");
25 FAIL_TEST("HOME environment variable is empty");
27 if (0 > test_asprintf(&path
, "%s/%s", home
, GNUPG_DIR
))
28 FAIL_TEST("Could not build $HOME/.gnupg string");
30 if (mkdir(path
, S_IRWXU
) && errno
!= EEXIST
) {
31 FAILURE_REASON("Could not create `%s' directory: %s", path
,
38 FAILURE_REASON("Could not change CWD to `%s': %s", path
,
45 if (-1 == (tmpfd
= mkstemp(tmpfile
))) {
46 FAILURE_REASON("Directory `%s' is not writable: %s", path
,
62 INIT_TEST("prepare_environment");
64 TEST("set up gnupg", test_setup_gnupg
);