]> git.meshlink.io Git - meshlink/blobdiff - test/encrypted.c
Don't use assert() to check the results of pthread_*() calls.
[meshlink] / test / encrypted.c
index 17b2fd80a7fc81f1a11ffdd30672758f97b2929a..ac0dfa92023afdb77a47a49170444b76fc3eeb69 100644 (file)
@@ -1,14 +1,19 @@
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
 #include <sys/time.h>
 #include <assert.h>
+#include <dirent.h>
 
 #include "meshlink.h"
 #include "utils.h"
 
-int main() {
+int main(void) {
        meshlink_set_log_cb(NULL, MESHLINK_DEBUG, log_cb);
 
        // Open a new meshlink instance.
@@ -36,5 +41,15 @@ int main() {
        // Destroy the mesh.
 
        assert(meshlink_destroy("encrypted_conf"));
-       assert(access("encrypted_conf", F_OK) == -1 && errno == ENOENT);
+
+       DIR *dir = opendir("encrypted_conf");
+       assert(dir);
+       struct dirent *ent;
+
+       while((ent = readdir(dir))) {
+               fprintf(stderr, "%s\n", ent->d_name);
+               assert(!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."));
+       }
+
+       closedir(dir);
 }