From cd97fc1211e5332b9f15a7027d5dcdd0d88b4c10 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sat, 13 Aug 2022 23:38:11 -0400 Subject: [PATCH 1/1] fix-check Various fixes for testing suite to work within aport context --- src/libpsl-native/test/CMakeLists.txt | 2 - .../test/test-getcommonlstat.cpp | 44 ++++++++--------- src/libpsl-native/test/test-getcommonstat.cpp | 48 +++++++++---------- 3 files changed, 46 insertions(+), 48 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9d3f4f5..70f526b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,3 @@ -add_subdirectory(googletest) - add_executable(psl-native-test test-getfileowner.cpp test-locale.cpp diff --git a/test/test-getcommonlstat.cpp b/test/test-getcommonlstat.cpp index ad73e9a..872bc58 100644 --- a/test/test-getcommonlstat.cpp +++ b/test/test-getcommonlstat.cpp @@ -40,9 +40,9 @@ TEST(GetCommonLStat, GetOwnerIdOfRoot) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %u /", "r"); + p = popen("/bin/stat -f %u /", "r"); #else - p = popen("/usr/bin/stat -c %u /", "r"); + p = popen("/bin/stat -c %u /", "r"); #endif int uid = -1; int result = fscanf(p, "%d", &uid); @@ -57,9 +57,9 @@ TEST(GetCommonLStat, GetGroupId) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %g /", "r"); + p = popen("/bin/stat -f %g /", "r"); #else - p = popen("/usr/bin/stat -c %g /", "r"); + p = popen("/bin/stat -c %g /", "r"); #endif int gid = -1; int result = fscanf(p, "%d", &gid); @@ -74,9 +74,9 @@ TEST(GetCommonLStat, GetInodeNumber) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %i /", "r"); + p = popen("/bin/stat -f %i /", "r"); #else - p = popen("/usr/bin/stat -c %i /", "r"); + p = popen("/bin/stat -c %i /", "r"); #endif long inode = -1; int result = fscanf(p, "%ld", &inode); @@ -91,9 +91,9 @@ TEST(GetCommonLStat, GetSize) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %z /", "r"); + p = popen("/bin/stat -f %z /", "r"); #else - p = popen("/usr/bin/stat -c %s /", "r"); + p = popen("/bin/stat -c %s /", "r"); #endif long size = -1; int result = fscanf(p, "%ld", &size); @@ -108,9 +108,9 @@ TEST(GetCommonLStat, GetBlockSize) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %k /", "r"); + p = popen("/bin/stat -f %k /", "r"); #else - p = popen("/usr/bin/stat -c %o /", "r"); + p = popen("/bin/stat -c %o /", "r"); #endif long bSize = -1; int result = fscanf(p, "%ld", &bSize); @@ -125,9 +125,9 @@ TEST(GetCommonLStat, GetBlockCount) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %b /", "r"); + p = popen("/bin/stat -f %b /", "r"); #else - p = popen("/usr/bin/stat -c %b /", "r"); + p = popen("/bin/stat -c %b /", "r"); #endif int bSize = -1; int result = fscanf(p, "%d", &bSize); @@ -142,9 +142,9 @@ TEST(GetCommonLStat, GetLinkCount) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %l /", "r"); + p = popen("/bin/stat -f %l /", "r"); #else - p = popen("/usr/bin/stat -c %h /", "r"); + p = popen("/bin/stat -c %h /", "r"); #endif int linkcount = -1; int result = fscanf(p, "%d", &linkcount); @@ -159,9 +159,9 @@ TEST(GetCommonLStat, GetDeviceId) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %d /", "r"); + p = popen("/bin/stat -f %d /", "r"); #else - p = popen("/usr/bin/stat -c %d /", "r"); + p = popen("/bin/stat -c %d /", "r"); #endif int deviceId = -1; int result = fscanf(p, "%d", &deviceId); @@ -176,9 +176,9 @@ TEST(GetCommonLStat, GetATime) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %a /", "r"); + p = popen("/bin/stat -f %a /", "r"); #else - p = popen("/usr/bin/stat -c %X /", "r"); + p = popen("/bin/stat -c %X /", "r"); #endif long aTime = -1; int result = fscanf(p, "%ld", &aTime); @@ -193,9 +193,9 @@ TEST(GetCommonLStat, GetMTime) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %m /", "r"); + p = popen("/bin/stat -f %m /", "r"); #else - p = popen("/usr/bin/stat -c %Y /", "r"); + p = popen("/bin/stat -c %Y /", "r"); #endif long mTime = -1; int result = fscanf(p, "%ld", &mTime); @@ -210,9 +210,9 @@ TEST(GetCommonLStat, GetCTime) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %c /", "r"); + p = popen("/bin/stat -f %c /", "r"); #else - p = popen("/usr/bin/stat -c %Z /", "r"); + p = popen("/bin/stat -c %Z /", "r"); #endif long cTime = -1; int result = fscanf(p, "%ld", &cTime); diff --git a/test/test-getcommonstat.cpp b/test/test-getcommonstat.cpp index 7407fc3..5d7f6d0 100644 --- a/test/test-getcommonstat.cpp +++ b/test/test-getcommonstat.cpp @@ -42,9 +42,9 @@ TEST(GetCommonStat, GetOwnerIdOfRoot) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %u /", "r"); + p = popen("/bin/stat -f %u /", "r"); #else - p = popen("/usr/bin/stat -c %u /", "r"); + p = popen("/bin/stat -c %u /", "r"); #endif int uid = -1; int result = fscanf(p, "%d", &uid); @@ -59,9 +59,9 @@ TEST(GetCommonStat, GetGroupId) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %g /", "r"); + p = popen("/bin/stat -f %g /", "r"); #else - p = popen("/usr/bin/stat -c %g /", "r"); + p = popen("/bin/stat -c %g /", "r"); #endif int gid = -1; int result = fscanf(p, "%d", &gid); @@ -76,9 +76,9 @@ TEST(GetCommonStat, GetInodeNumber) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %i /", "r"); + p = popen("/bin/stat -f %i /", "r"); #else - p = popen("/usr/bin/stat -c %i /", "r"); + p = popen("/bin/stat -c %i /", "r"); #endif long inode = -1; int result = fscanf(p, "%ld", &inode); @@ -94,10 +94,10 @@ TEST(GetCommonStat, GetMode) CommonStat cs; unsigned int mode = -1; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %p /", "r"); + p = popen("/bin/stat -f %p /", "r"); int result = fscanf(p, "%o", &mode); #else - p = popen("/usr/bin/stat -c %f /", "r"); + p = popen("/bin/stat -c %f /", "r"); int result = fscanf(p, "%x", &mode); #endif pclose(p); @@ -111,9 +111,9 @@ TEST(GetCommonStat, GetSize) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %z /", "r"); + p = popen("/bin/stat -f %z /", "r"); #else - p = popen("/usr/bin/stat -c %s /", "r"); + p = popen("/bin/stat -c %s /", "r"); #endif long size = -1; int result = fscanf(p, "%ld", &size); @@ -128,9 +128,9 @@ TEST(GetCommonStat, GetBlockSize) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %k /", "r"); + p = popen("/bin/stat -f %k /", "r"); #else - p = popen("/usr/bin/stat -c %o /", "r"); + p = popen("/bin/stat -c %o /", "r"); #endif long bSize = -1; int result = fscanf(p, "%ld", &bSize); @@ -145,9 +145,9 @@ TEST(GetCommonStat, GetBlockCount) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %b /", "r"); + p = popen("/bin/stat -f %b /", "r"); #else - p = popen("/usr/bin/stat -c %b /", "r"); + p = popen("/bin/stat -c %b /", "r"); #endif int bSize = -1; int result = fscanf(p, "%d", &bSize); @@ -162,9 +162,9 @@ TEST(GetCommonStat, GetLinkCount) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %l /", "r"); + p = popen("/bin/stat -f %l /", "r"); #else - p = popen("/usr/bin/stat -c %h /", "r"); + p = popen("/bin/stat -c %h /", "r"); #endif int linkcount = -1; int result = fscanf(p, "%d", &linkcount); @@ -179,9 +179,9 @@ TEST(GetCommonStat, GetDeviceId) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %d /", "r"); + p = popen("/bin/stat -f %d /", "r"); #else - p = popen("/usr/bin/stat -c %d /", "r"); + p = popen("/bin/stat -c %d /", "r"); #endif int deviceId = -1; int result = fscanf(p, "%d", &deviceId); @@ -196,9 +196,9 @@ TEST(GetCommonStat, GetATime) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %a /", "r"); + p = popen("/bin/stat -f %a /", "r"); #else - p = popen("/usr/bin/stat -c %X /", "r"); + p = popen("/bin/stat -c %X /", "r"); #endif long aTime = -1; int result = fscanf(p, "%ld", &aTime); @@ -213,9 +213,9 @@ TEST(GetCommonStat, GetMTime) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %m /", "r"); + p = popen("/bin/stat -f %m /", "r"); #else - p = popen("/usr/bin/stat -c %Y /", "r"); + p = popen("/bin/stat -c %Y /", "r"); #endif long mTime = -1; int result = fscanf(p, "%ld", &mTime); @@ -230,9 +230,9 @@ TEST(GetCommonStat, GetCTime) FILE *p; CommonStat cs; #if defined (__APPLE__) - p = popen("/usr/bin/stat -f %c /", "r"); + p = popen("/bin/stat -f %c /", "r"); #else - p = popen("/usr/bin/stat -c %Z /", "r"); + p = popen("/bin/stat -c %Z /", "r"); #endif long cTime = -1; int result = fscanf(p, "%ld", &cTime); -- 2.36.2