aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorBin Meng <bin.meng@windriver.com>2022-08-24 17:39:50 +0800
committerThomas Huth <thuth@redhat.com>2022-08-25 15:24:09 +0200
commit413bebc04603d87d1889c919fbdd4adf30d4ebb5 (patch)
tree909f642556b0d633694a2698fbe7bda3fcb6dec1 /tests/unit
parent3c239aa77ed19521992a0b14594907adc0d79a6c (diff)
tests: Use g_mkdir_with_parents()
Use the same g_mkdir_with_parents() call to create a directory on all platforms. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20220824094029.1634519-13-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test-crypto-tlscredsx509.c4
-rw-r--r--tests/unit/test-crypto-tlssession.c6
-rw-r--r--tests/unit/test-io-channel-tls.c6
3 files changed, 8 insertions, 8 deletions
diff --git a/tests/unit/test-crypto-tlscredsx509.c b/tests/unit/test-crypto-tlscredsx509.c
index aab4149b56..3c25d75ca1 100644
--- a/tests/unit/test-crypto-tlscredsx509.c
+++ b/tests/unit/test-crypto-tlscredsx509.c
@@ -75,7 +75,7 @@ static void test_tls_creds(const void *opaque)
QCryptoTLSCreds *creds;
#define CERT_DIR "tests/test-crypto-tlscredsx509-certs/"
- mkdir(CERT_DIR, 0700);
+ g_mkdir_with_parents(CERT_DIR, 0700);
unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
if (data->isServer) {
@@ -141,7 +141,7 @@ int main(int argc, char **argv)
g_test_init(&argc, &argv, NULL);
g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1);
- mkdir(WORKDIR, 0700);
+ g_mkdir_with_parents(WORKDIR, 0700);
test_tls_init(KEYFILE);
diff --git a/tests/unit/test-crypto-tlssession.c b/tests/unit/test-crypto-tlssession.c
index f222959d36..615a1344b4 100644
--- a/tests/unit/test-crypto-tlssession.c
+++ b/tests/unit/test-crypto-tlssession.c
@@ -249,8 +249,8 @@ static void test_crypto_tls_session_x509(const void *opaque)
#define CLIENT_CERT_DIR "tests/test-crypto-tlssession-client/"
#define SERVER_CERT_DIR "tests/test-crypto-tlssession-server/"
- mkdir(CLIENT_CERT_DIR, 0700);
- mkdir(SERVER_CERT_DIR, 0700);
+ g_mkdir_with_parents(CLIENT_CERT_DIR, 0700);
+ g_mkdir_with_parents(SERVER_CERT_DIR, 0700);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
@@ -398,7 +398,7 @@ int main(int argc, char **argv)
g_test_init(&argc, &argv, NULL);
g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1);
- mkdir(WORKDIR, 0700);
+ g_mkdir_with_parents(WORKDIR, 0700);
test_tls_init(KEYFILE);
test_tls_psk_init(PSKFILE);
diff --git a/tests/unit/test-io-channel-tls.c b/tests/unit/test-io-channel-tls.c
index f6fb988c01..cc39247556 100644
--- a/tests/unit/test-io-channel-tls.c
+++ b/tests/unit/test-io-channel-tls.c
@@ -125,8 +125,8 @@ static void test_io_channel_tls(const void *opaque)
#define CLIENT_CERT_DIR "tests/test-io-channel-tls-client/"
#define SERVER_CERT_DIR "tests/test-io-channel-tls-server/"
- mkdir(CLIENT_CERT_DIR, 0700);
- mkdir(SERVER_CERT_DIR, 0700);
+ g_mkdir_with_parents(CLIENT_CERT_DIR, 0700);
+ g_mkdir_with_parents(SERVER_CERT_DIR, 0700);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
@@ -273,7 +273,7 @@ int main(int argc, char **argv)
g_test_init(&argc, &argv, NULL);
g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1);
- mkdir(WORKDIR, 0700);
+ g_mkdir_with_parents(WORKDIR, 0700);
test_tls_init(KEYFILE);