Browse Source

mkdir → utun_mkdir в тестах для кроссплатформенной сборки (MSYS2/MinGW)

topo_upd
Evgeny 2 months ago
parent
commit
98f3049e6b
  1. 3
      tests/test_media_async.c
  2. 7
      tests/test_media_index.c

3
tests/test_media_async.c

@ -5,6 +5,7 @@
// Проверяется корректность каждого результата и отсутствие заклиниваний. // Проверяется корректность каждого результата и отсутствие заклиниваний.
#include "../src/media_async/media_async.h" #include "../src/media_async/media_async.h"
#include "../lib/platform_compat.h"
#include <pthread.h> #include <pthread.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -143,7 +144,7 @@ int main(void) {
int ret = 0; int ret = 0;
snprintf(g_test_dir, sizeof(g_test_dir), "/tmp/test_media_async_%d", (int)getpid()); snprintf(g_test_dir, sizeof(g_test_dir), "/tmp/test_media_async_%d", (int)getpid());
if (mkdir(g_test_dir, 0755) != 0) { if (utun_mkdir(g_test_dir, 0755) != 0) {
perror("mkdir"); return 1; perror("mkdir"); return 1;
} }

7
tests/test_media_index.c

@ -17,6 +17,7 @@
#include "../lib/u_async.h" #include "../lib/u_async.h"
#include "../lib/mem.h" #include "../lib/mem.h"
#include "../lib/debug_config.h" #include "../lib/debug_config.h"
#include "../lib/platform_compat.h"
#include <openssl/evp.h> #include <openssl/evp.h>
#include <sqlite3.h> #include <sqlite3.h>
@ -418,14 +419,14 @@ static int test_register_async_flow(void) {
TEST("register_async: copy file + verify DB"); TEST("register_async: copy file + verify DB");
char tempd[256]; char tempd[256];
snprintf(tempd, sizeof(tempd), "/tmp/test_media_idx_%d", (int)getpid()); snprintf(tempd, sizeof(tempd), "/tmp/test_media_idx_%d", (int)getpid());
mkdir(tempd, 0755); utun_mkdir(tempd, 0755);
char src[512]; snprintf(src, sizeof(src), "%s/src.bin", tempd); char src[512]; snprintf(src, sizeof(src), "%s/src.bin", tempd);
char dst[512]; snprintf(dst, sizeof(dst), "%s/media/ch_test/dst.bin", tempd); char dst[512]; snprintf(dst, sizeof(dst), "%s/media/ch_test/dst.bin", tempd);
{ {
char t1[512], t2[512]; char t1[512], t2[512];
snprintf(t1, sizeof(t1), "%s/media", tempd); mkdir(t1, 0755); snprintf(t1, sizeof(t1), "%s/media", tempd); utun_mkdir(t1, 0755);
snprintf(t2, sizeof(t2), "%s/media/ch_test", tempd); mkdir(t2, 0755); snprintf(t2, sizeof(t2), "%s/media/ch_test", tempd); utun_mkdir(t2, 0755);
} }
create_file(src, 400); // 400 bytes → 4 chunks of 100 create_file(src, 400); // 400 bytes → 4 chunks of 100

Loading…
Cancel
Save