]> granicus.if.org Git - gc/commitdiff
Allow to force executable pages allocation in gctest
authorIvan Maidanski <ivmai@mail.ru>
Thu, 20 Dec 2018 08:34:12 +0000 (11:34 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 21 Dec 2018 08:41:28 +0000 (11:41 +0300)
Pass -D TEST_PAGES_EXECUTABLE to CFLAGS to enable the executable pages
allocation in gctest even if the collector is compiled with
NO_EXECUTE_PERMISSION.

* tests/test.c (INIT_PAGES_EXECUTABLE): New macro (calls
GC_set_pages_executable(1) if TEST_PAGES_EXECUTABLE).
* tests/test.c (GC_COND_INIT): Call INIT_PAGES_EXECUTABLE (before
GC_OPT_INIT).
* tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK]
(main): Remove UNTESTED(GC_set_pages_executable).

tests/test.c

index ac4679fd5ec33ac4947d7aed6edc40e92431d938..764c34a7b476342c0399e9deb67b80ac1ee82dab 100644 (file)
 # define INIT_MANUAL_VDB_ALLOWED /* empty */
 #endif
 
+#ifdef TEST_PAGES_EXECUTABLE
+# define INIT_PAGES_EXECUTABLE GC_set_pages_executable(1)
+#else
+# define INIT_PAGES_EXECUTABLE (void)0
+#endif
+
 #define CHECK_GCLIB_VERSION \
             if (GC_get_version() != ((GC_VERSION_MAJOR<<16) \
                                     | (GC_VERSION_MINOR<<8) \
 #endif
 
 #define GC_COND_INIT() \
-    INIT_FORK_SUPPORT; INIT_MANUAL_VDB_ALLOWED; \
+    INIT_FORK_SUPPORT; INIT_MANUAL_VDB_ALLOWED; INIT_PAGES_EXECUTABLE; \
     GC_OPT_INIT; CHECK_GCLIB_VERSION; \
     INIT_PRINT_STATS; INIT_FIND_LEAK; INIT_PERF_MEASUREMENT
 
@@ -1971,7 +1977,6 @@ void GC_CALLBACK warn_proc(char *msg, GC_word p)
        UNTESTED(GC_set_on_collection_event);
        UNTESTED(GC_set_on_heap_resize);
        UNTESTED(GC_set_oom_fn);
-       UNTESTED(GC_set_pages_executable);
        UNTESTED(GC_set_push_other_roots);
        UNTESTED(GC_set_start_callback);
        UNTESTED(GC_set_stop_func);