mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 16:38:54 +02:00
Merge branch 'backport-2952-win32-test-fixes-glib-2-74' into 'glib-2-74'
Backport !2952 “Various win32 test fixes” to glib-2-74 See merge request GNOME/glib!2958
This commit is contained in:
@@ -2441,6 +2441,26 @@ set_symlink (char *filename,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined (HAVE_UTIMES) || defined (HAVE_UTIMENSAT) || defined(G_OS_WIN32)
|
||||||
|
static int
|
||||||
|
lazy_stat (const char *filename,
|
||||||
|
GStatBuf *statbuf,
|
||||||
|
gboolean *called_stat)
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
|
||||||
|
if (*called_stat)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
res = g_stat (filename, statbuf);
|
||||||
|
|
||||||
|
if (res == 0)
|
||||||
|
*called_stat = TRUE;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined (G_OS_WIN32)
|
#if defined (G_OS_WIN32)
|
||||||
/* From
|
/* From
|
||||||
* https://support.microsoft.com/en-ca/help/167296/how-to-convert-a-unix-time-t-to-a-win32-filetime-or-systemtime
|
* https://support.microsoft.com/en-ca/help/167296/how-to-convert-a-unix-time-t-to-a-win32-filetime-or-systemtime
|
||||||
@@ -2546,6 +2566,8 @@ set_mtime_atime (const char *filename,
|
|||||||
FILETIME *p_mtime = NULL;
|
FILETIME *p_mtime = NULL;
|
||||||
FILETIME *p_atime = NULL;
|
FILETIME *p_atime = NULL;
|
||||||
DWORD gle;
|
DWORD gle;
|
||||||
|
GStatBuf statbuf;
|
||||||
|
gboolean got_stat = FALSE;
|
||||||
|
|
||||||
/* ATIME */
|
/* ATIME */
|
||||||
if (atime_value)
|
if (atime_value)
|
||||||
@@ -2554,30 +2576,44 @@ set_mtime_atime (const char *filename,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
val_usec = 0;
|
val_usec = 0;
|
||||||
val_nsec = 0;
|
val_nsec = 0;
|
||||||
if (atime_usec_value &&
|
|
||||||
!get_uint32 (atime_usec_value, &val_usec, error))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Convert to nanoseconds. Clamp the usec value if it’s going to overflow,
|
|
||||||
* as %G_MAXINT32 will trigger a ‘too big’ error in
|
|
||||||
* _g_win32_unix_time_to_filetime() anyway. */
|
|
||||||
val_nsec = (val_usec > G_MAXINT32 / 1000) ? G_MAXINT32 : (val_usec * 1000);
|
|
||||||
|
|
||||||
if (atime_nsec_value &&
|
|
||||||
!get_uint32 (atime_nsec_value, &val_nsec, error))
|
|
||||||
return FALSE;
|
|
||||||
if (val_nsec > 0)
|
|
||||||
{
|
|
||||||
if (!_g_win32_unix_time_to_filetime (val, val_nsec, &atime, error))
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!_g_win32_unix_time_to_filetime (val, val_usec, &atime, error))
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
p_atime = &atime;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (lazy_stat (filename, &statbuf, &got_stat) == 0)
|
||||||
|
{
|
||||||
|
val = statbuf.st_atime;
|
||||||
|
#if defined (HAVE_STRUCT_STAT_ST_ATIMENSEC)
|
||||||
|
val_nsec = statbuf.st_atimensec;
|
||||||
|
#elif defined (HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC)
|
||||||
|
val_nsec = statbuf.st_atim.tv_nsec;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (atime_usec_value &&
|
||||||
|
!get_uint32 (atime_usec_value, &val_usec, error))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* Convert to nanoseconds. Clamp the usec value if it’s going to overflow,
|
||||||
|
* as %G_MAXINT32 will trigger a ‘too big’ error in
|
||||||
|
* _g_win32_unix_time_to_filetime() anyway. */
|
||||||
|
val_nsec = (val_usec > G_MAXINT32 / 1000) ? G_MAXINT32 : (val_usec * 1000);
|
||||||
|
|
||||||
|
if (atime_nsec_value &&
|
||||||
|
!get_uint32 (atime_nsec_value, &val_nsec, error))
|
||||||
|
return FALSE;
|
||||||
|
if (val_nsec > 0)
|
||||||
|
{
|
||||||
|
if (!_g_win32_unix_time_to_filetime (val, val_nsec, &atime, error))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!_g_win32_unix_time_to_filetime (val, val_usec, &atime, error))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
p_atime = &atime;
|
||||||
|
|
||||||
/* MTIME */
|
/* MTIME */
|
||||||
if (mtime_value)
|
if (mtime_value)
|
||||||
@@ -2586,30 +2622,43 @@ set_mtime_atime (const char *filename,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
val_usec = 0;
|
val_usec = 0;
|
||||||
val_nsec = 0;
|
val_nsec = 0;
|
||||||
if (mtime_usec_value &&
|
|
||||||
!get_uint32 (mtime_usec_value, &val_usec, error))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Convert to nanoseconds. Clamp the usec value if it’s going to overflow,
|
|
||||||
* as %G_MAXINT32 will trigger a ‘too big’ error in
|
|
||||||
* _g_win32_unix_time_to_filetime() anyway. */
|
|
||||||
val_nsec = (val_usec > G_MAXINT32 / 1000) ? G_MAXINT32 : (val_usec * 1000);
|
|
||||||
|
|
||||||
if (mtime_nsec_value &&
|
|
||||||
!get_uint32 (mtime_nsec_value, &val_nsec, error))
|
|
||||||
return FALSE;
|
|
||||||
if (val_nsec > 0)
|
|
||||||
{
|
|
||||||
if (!_g_win32_unix_time_to_filetime (val, val_nsec, &mtime, error))
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!_g_win32_unix_time_to_filetime (val, val_usec, &mtime, error))
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
p_mtime = &mtime;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (lazy_stat (filename, &statbuf, &got_stat) == 0)
|
||||||
|
{
|
||||||
|
val = statbuf.st_mtime;
|
||||||
|
#if defined (HAVE_STRUCT_STAT_ST_MTIMENSEC)
|
||||||
|
val_nsec = statbuf.st_mtimensec;
|
||||||
|
#elif defined (HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
|
||||||
|
val_nsec = statbuf.st_mtim.tv_nsec;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mtime_usec_value &&
|
||||||
|
!get_uint32 (mtime_usec_value, &val_usec, error))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* Convert to nanoseconds. Clamp the usec value if it’s going to overflow,
|
||||||
|
* as %G_MAXINT32 will trigger a ‘too big’ error in
|
||||||
|
* _g_win32_unix_time_to_filetime() anyway. */
|
||||||
|
val_nsec = (val_usec > G_MAXINT32 / 1000) ? G_MAXINT32 : (val_usec * 1000);
|
||||||
|
|
||||||
|
if (mtime_nsec_value &&
|
||||||
|
!get_uint32 (mtime_nsec_value, &val_nsec, error))
|
||||||
|
return FALSE;
|
||||||
|
if (val_nsec > 0)
|
||||||
|
{
|
||||||
|
if (!_g_win32_unix_time_to_filetime (val, val_nsec, &mtime, error))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!_g_win32_unix_time_to_filetime (val, val_usec, &mtime, error))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
p_mtime = &mtime;
|
||||||
|
|
||||||
filename_utf16 = g_utf8_to_utf16 (filename, -1, NULL, NULL, error);
|
filename_utf16 = g_utf8_to_utf16 (filename, -1, NULL, NULL, error);
|
||||||
|
|
||||||
@@ -2654,24 +2703,6 @@ set_mtime_atime (const char *filename,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#elif defined (HAVE_UTIMES) || defined (HAVE_UTIMENSAT)
|
#elif defined (HAVE_UTIMES) || defined (HAVE_UTIMENSAT)
|
||||||
static int
|
|
||||||
lazy_stat (char *filename,
|
|
||||||
struct stat *statbuf,
|
|
||||||
gboolean *called_stat)
|
|
||||||
{
|
|
||||||
int res;
|
|
||||||
|
|
||||||
if (*called_stat)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
res = g_stat (filename, statbuf);
|
|
||||||
|
|
||||||
if (res == 0)
|
|
||||||
*called_stat = TRUE;
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
set_mtime_atime (char *filename,
|
set_mtime_atime (char *filename,
|
||||||
const GFileAttributeValue *mtime_value,
|
const GFileAttributeValue *mtime_value,
|
||||||
@@ -2684,7 +2715,7 @@ set_mtime_atime (char *filename,
|
|||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
guint64 val = 0;
|
guint64 val = 0;
|
||||||
struct stat statbuf;
|
GStatBuf statbuf;
|
||||||
gboolean got_stat = FALSE;
|
gboolean got_stat = FALSE;
|
||||||
#ifdef HAVE_UTIMENSAT
|
#ifdef HAVE_UTIMENSAT
|
||||||
struct timespec times_n[2] = { {0, 0}, {0, 0} };
|
struct timespec times_n[2] = { {0, 0}, {0, 0} };
|
||||||
|
@@ -252,10 +252,10 @@ test_icon (void)
|
|||||||
names = g_themed_icon_get_names (G_THEMED_ICON (icon));
|
names = g_themed_icon_get_names (G_THEMED_ICON (icon));
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
g_assert_true (g_strv_contains (names, "text-*"));
|
g_assert_true (g_strv_contains (names, "text-*"));
|
||||||
|
#elif defined(G_OS_WIN32)
|
||||||
|
g_assert_cmpuint (g_strv_length ((GStrv) names), >, 0);
|
||||||
#else
|
#else
|
||||||
#ifndef G_OS_WIN32
|
|
||||||
g_assert_true (g_strv_contains (names, "text-plain"));
|
g_assert_true (g_strv_contains (names, "text-plain"));
|
||||||
#endif
|
|
||||||
g_assert_true (g_strv_contains (names, "text-x-generic"));
|
g_assert_true (g_strv_contains (names, "text-x-generic"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -207,26 +207,25 @@ test_valid_thumbnail_size (gconstpointer data)
|
|||||||
{
|
{
|
||||||
GFile *source;
|
GFile *source;
|
||||||
GFile *thumbnail;
|
GFile *thumbnail;
|
||||||
|
GFile *f;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GFileInfo *info;
|
GFileInfo *info;
|
||||||
const gchar *size = data;
|
const gchar *size = data;
|
||||||
char *thumbnail_path;
|
|
||||||
|
|
||||||
thumbnail = create_thumbnail_from_test_file ("valid.png", size, &source);
|
thumbnail = create_thumbnail_from_test_file ("valid.png", size, &source);
|
||||||
info = g_file_query_info (source, THUMBNAILS_ATTRIBS, G_FILE_QUERY_INFO_NONE,
|
info = g_file_query_info (source, THUMBNAILS_ATTRIBS, G_FILE_QUERY_INFO_NONE,
|
||||||
NULL, &error);
|
NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
|
||||||
thumbnail_path = g_file_get_path (thumbnail);
|
|
||||||
|
|
||||||
g_assert_true (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH));
|
g_assert_true (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH));
|
||||||
g_assert_true (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID));
|
g_assert_true (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID));
|
||||||
g_assert_false (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAILING_FAILED));
|
g_assert_false (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAILING_FAILED));
|
||||||
|
|
||||||
|
f = g_file_new_for_path (g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH));
|
||||||
g_assert_cmpstr (
|
g_assert_cmpstr (
|
||||||
g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH),
|
g_file_peek_path (f),
|
||||||
==,
|
==,
|
||||||
thumbnail_path
|
g_file_peek_path (thumbnail)
|
||||||
);
|
);
|
||||||
|
|
||||||
/* TODO: We can't really test this without having a proper thumbnail created
|
/* TODO: We can't really test this without having a proper thumbnail created
|
||||||
@@ -238,7 +237,7 @@ test_valid_thumbnail_size (gconstpointer data)
|
|||||||
g_clear_object (&thumbnail);
|
g_clear_object (&thumbnail);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
g_clear_object (&info);
|
g_clear_object (&info);
|
||||||
g_free (thumbnail_path);
|
g_clear_object (&f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -310,7 +309,7 @@ test_thumbnails_size_priority (void)
|
|||||||
for (i = 0; i < G_N_ELEMENTS (SIZES_NAMES); i++)
|
for (i = 0; i < G_N_ELEMENTS (SIZES_NAMES); i++)
|
||||||
{
|
{
|
||||||
GFile *thumbnail = create_thumbnail (source, SIZES_NAMES[i]);
|
GFile *thumbnail = create_thumbnail (source, SIZES_NAMES[i]);
|
||||||
gchar *thumbnail_path = g_file_get_path (thumbnail);
|
GFile *f;
|
||||||
|
|
||||||
g_ptr_array_add (sized_thumbnails, thumbnail);
|
g_ptr_array_add (sized_thumbnails, thumbnail);
|
||||||
|
|
||||||
@@ -322,14 +321,15 @@ test_thumbnails_size_priority (void)
|
|||||||
g_assert_true (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID));
|
g_assert_true (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID));
|
||||||
g_assert_false (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAILING_FAILED));
|
g_assert_false (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAILING_FAILED));
|
||||||
|
|
||||||
|
f = g_file_new_for_path (g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH));
|
||||||
g_assert_cmpstr (
|
g_assert_cmpstr (
|
||||||
g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH),
|
g_file_peek_path (f),
|
||||||
==,
|
==,
|
||||||
thumbnail_path
|
g_file_peek_path (thumbnail)
|
||||||
);
|
);
|
||||||
|
|
||||||
g_free (thumbnail_path);
|
|
||||||
g_clear_object (&info);
|
g_clear_object (&info);
|
||||||
|
g_clear_object (&f);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_assert_cmpuint (sized_thumbnails->len, ==, G_N_ELEMENTS (SIZES_NAMES));
|
g_assert_cmpuint (sized_thumbnails->len, ==, G_N_ELEMENTS (SIZES_NAMES));
|
||||||
@@ -339,7 +339,7 @@ test_thumbnails_size_priority (void)
|
|||||||
{
|
{
|
||||||
GFile *thumbnail = g_ptr_array_index (sized_thumbnails, i - 1);
|
GFile *thumbnail = g_ptr_array_index (sized_thumbnails, i - 1);
|
||||||
GFile *less_priority_thumbnail = g_ptr_array_index (sized_thumbnails, i - 2);
|
GFile *less_priority_thumbnail = g_ptr_array_index (sized_thumbnails, i - 2);
|
||||||
gchar *thumbnail_path = g_file_get_path (less_priority_thumbnail);
|
GFile *f;
|
||||||
|
|
||||||
g_file_delete (thumbnail, NULL, &error);
|
g_file_delete (thumbnail, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@@ -352,14 +352,15 @@ test_thumbnails_size_priority (void)
|
|||||||
g_assert_true (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID));
|
g_assert_true (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID));
|
||||||
g_assert_false (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAILING_FAILED));
|
g_assert_false (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_THUMBNAILING_FAILED));
|
||||||
|
|
||||||
|
f = g_file_new_for_path (g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH));
|
||||||
g_assert_cmpstr (
|
g_assert_cmpstr (
|
||||||
g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH),
|
g_file_peek_path (f),
|
||||||
==,
|
==,
|
||||||
thumbnail_path
|
g_file_peek_path (less_priority_thumbnail)
|
||||||
);
|
);
|
||||||
|
|
||||||
g_free (thumbnail_path);
|
|
||||||
g_clear_object (&info);
|
g_clear_object (&info);
|
||||||
|
g_clear_object (&f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* And now let's remove the last valid one, so that failed should have priority */
|
/* And now let's remove the last valid one, so that failed should have priority */
|
||||||
|
@@ -59,22 +59,21 @@ class TestAssertMessage(unittest.TestCase):
|
|||||||
self.__gdb = shutil.which("gdb")
|
self.__gdb = shutil.which("gdb")
|
||||||
self.timeout_seconds = 10 # seconds per test
|
self.timeout_seconds = 10 # seconds per test
|
||||||
|
|
||||||
|
ext = ""
|
||||||
|
if os.name == "nt":
|
||||||
|
ext = ".exe"
|
||||||
if "G_TEST_BUILDDIR" in os.environ:
|
if "G_TEST_BUILDDIR" in os.environ:
|
||||||
self.__assert_msg_test = os.path.join(
|
self.__assert_msg_test = os.path.join(
|
||||||
os.environ["G_TEST_BUILDDIR"], "assert-msg-test"
|
os.environ["G_TEST_BUILDDIR"], "assert-msg-test" + ext
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.__assert_msg_test = os.path.join(
|
self.__assert_msg_test = os.path.join(
|
||||||
os.path.dirname(__file__), "assert-msg-test"
|
os.path.dirname(__file__), "assert-msg-test" + ext
|
||||||
)
|
)
|
||||||
print("assert-msg-test:", self.__assert_msg_test)
|
print("assert-msg-test:", self.__assert_msg_test)
|
||||||
|
|
||||||
def runAssertMessage(self, *args):
|
def runAssertMessage(self, *args):
|
||||||
argv = [self.__assert_msg_test]
|
argv = [self.__assert_msg_test]
|
||||||
# shebang lines are not supported on native
|
|
||||||
# Windows consoles
|
|
||||||
if os.name == "nt":
|
|
||||||
argv.insert(0, sys.executable)
|
|
||||||
argv.extend(args)
|
argv.extend(args)
|
||||||
print("Running:", argv)
|
print("Running:", argv)
|
||||||
|
|
||||||
@@ -135,7 +134,10 @@ class TestAssertMessage(unittest.TestCase):
|
|||||||
"""Test running g_assert() and fail the program."""
|
"""Test running g_assert() and fail the program."""
|
||||||
result = self.runAssertMessage()
|
result = self.runAssertMessage()
|
||||||
|
|
||||||
self.assertEqual(result.info.returncode, -6)
|
if os.name == "nt":
|
||||||
|
self.assertEqual(result.info.returncode, 3)
|
||||||
|
else:
|
||||||
|
self.assertEqual(result.info.returncode, -6)
|
||||||
self.assertIn("assertion failed: (42 < 0)", result.out)
|
self.assertIn("assertion failed: (42 < 0)", result.out)
|
||||||
|
|
||||||
def test_gdb_gassert(self):
|
def test_gdb_gassert(self):
|
||||||
@@ -144,12 +146,14 @@ class TestAssertMessage(unittest.TestCase):
|
|||||||
self.skipTest("GDB is not installed, skipping this test!")
|
self.skipTest("GDB is not installed, skipping this test!")
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile(
|
with tempfile.NamedTemporaryFile(
|
||||||
prefix="assert-msg-test-", suffix=".gdb", mode="w"
|
prefix="assert-msg-test-", suffix=".gdb", mode="w", delete=False
|
||||||
) as tmp:
|
) as tmp:
|
||||||
tmp.write(GDB_SCRIPT)
|
try:
|
||||||
tmp.flush()
|
tmp.write(GDB_SCRIPT)
|
||||||
|
tmp.close()
|
||||||
result = self.runGdbAssertMessage("-x", tmp.name, self.__assert_msg_test)
|
result = self.runGdbAssertMessage("-x", tmp.name, self.__assert_msg_test)
|
||||||
|
finally:
|
||||||
|
os.unlink(tmp.name)
|
||||||
|
|
||||||
# Some CI environments disable ptrace (as they’re running in a
|
# Some CI environments disable ptrace (as they’re running in a
|
||||||
# container). If so, skip the test as there’s nothing we can do.
|
# container). If so, skip the test as there’s nothing we can do.
|
||||||
|
@@ -274,7 +274,7 @@ test_thread_sort (gboolean sort)
|
|||||||
if (sort) {
|
if (sort) {
|
||||||
g_thread_pool_set_sort_function (pool,
|
g_thread_pool_set_sort_function (pool,
|
||||||
test_thread_sort_compare_func,
|
test_thread_sort_compare_func,
|
||||||
GUINT_TO_POINTER (69));
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < limit; i++) {
|
for (i = 0; i < limit; i++) {
|
||||||
@@ -291,7 +291,7 @@ test_thread_sort (gboolean sort)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_assert_cmpint (g_thread_pool_get_max_threads (pool), ==, (gint) max_threads);
|
g_assert_cmpint (g_thread_pool_get_max_threads (pool), ==, (gint) max_threads);
|
||||||
g_assert_cmpuint (g_thread_pool_get_num_threads (pool), ==,
|
g_assert_cmpuint (g_thread_pool_get_num_threads (pool), <=,
|
||||||
(guint) g_thread_pool_get_max_threads (pool));
|
(guint) g_thread_pool_get_max_threads (pool));
|
||||||
g_thread_pool_free (pool, TRUE, TRUE);
|
g_thread_pool_free (pool, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
@@ -55,12 +55,6 @@ class TestGobjectQuery(unittest.TestCase):
|
|||||||
|
|
||||||
def runGobjectQuery(self, *args):
|
def runGobjectQuery(self, *args):
|
||||||
argv = [self.__gobject_query]
|
argv = [self.__gobject_query]
|
||||||
|
|
||||||
# shebang lines are not supported on native
|
|
||||||
# Windows consoles
|
|
||||||
if os.name == "nt":
|
|
||||||
argv.insert(0, sys.executable)
|
|
||||||
|
|
||||||
argv.extend(args)
|
argv.extend(args)
|
||||||
print("Running:", argv)
|
print("Running:", argv)
|
||||||
|
|
||||||
@@ -75,7 +69,8 @@ class TestGobjectQuery(unittest.TestCase):
|
|||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
env=env,
|
env=env,
|
||||||
universal_newlines=True,
|
text=True,
|
||||||
|
encoding='utf-8',
|
||||||
)
|
)
|
||||||
info.check_returncode()
|
info.check_returncode()
|
||||||
out = info.stdout.strip()
|
out = info.stdout.strip()
|
||||||
|
Reference in New Issue
Block a user