# HG changeset patch # User Ben Wing # Date 1268925548 18000 # Node ID 6bff4f219697b7c7e5acf3b52d5c0cd5b56ccab2 # Parent c97dc3b6de63e49e660748fe38b7b2e36a72bcca fix crash etc. in tests.c/c-tests.el -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-03-18 Ben Wing * tests.c: * tests.c (Ftest_data_format_conversion): Need to GCPRO newly created objects or we'll eventually get a crash due to occurrence of call2(). tests/ChangeLog addition: 2010-03-18 Ben Wing * automated/c-tests.el: * automated/c-tests.el (when): Use `with-temp-buffer' so results don't get written into source file. diff -r c97dc3b6de63 -r 6bff4f219697 src/ChangeLog --- a/src/ChangeLog Thu Mar 18 10:17:13 2010 -0500 +++ b/src/ChangeLog Thu Mar 18 10:19:08 2010 -0500 @@ -1,3 +1,10 @@ +2010-03-18 Ben Wing + + * tests.c: + * tests.c (Ftest_data_format_conversion): + Need to GCPRO newly created objects or we'll eventually get + a crash due to occurrence of call2(). + 2010-03-15 Ben Wing * extents.c (Fprevious_single_property_change): diff -r c97dc3b6de63 -r 6bff4f219697 src/tests.c --- a/src/tests.c Thu Mar 18 10:17:13 2010 -0500 +++ b/src/tests.c Thu Mar 18 10:19:08 2010 -0500 @@ -49,7 +49,7 @@ ()) { void *ptr; Bytecount len; - Lisp_Object string, opaque, conversion_result = Qnil; + Lisp_Object string = Qnil, opaque = Qnil, conversion_result = Qnil; Ibyte int_foo[] = "\n\nfoo\nbar"; Extbyte ext_unix[]= "\n\nfoo\nbar"; @@ -72,6 +72,20 @@ Lisp_Object string_latin1 = make_string (int_latin1, sizeof (int_latin1) - 1); int autodetect_eol_p = !NILP (Fsymbol_value (intern ("eol-detection-enabled-p"))); + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; + struct gcpro ngcpro1, ngcpro2, ngcpro3; +#ifdef MULE + struct gcpro ngcpro4; +#endif + + /* DFC conversion inhibits GC, but we have a call2() below which calls + Lisp, which can trigger GC, so we need to GC-protect everything here. */ + GCPRO5 (string, opaque, conversion_result, opaque_dos, string_foo); +#ifdef MULE + NGCPRO4 (string_latin2, opaque_latin, opaque0_latin, string_latin1); +#else + NGCPRO3 (opaque_latin, opaque0_latin, string_latin1); +#endif /* Check for expected strings before and after conversion. Conversions depend on whether MULE is defined. */ @@ -541,6 +555,8 @@ Qbinary); DFC_CHECK_DATA (ptr, len, ext_dos, "DOS Lisp opaque, ALLOCA, binary"); + NUNGCPRO; + UNGCPRO; return conversion_result; } diff -r c97dc3b6de63 -r 6bff4f219697 tests/ChangeLog --- a/tests/ChangeLog Thu Mar 18 10:17:13 2010 -0500 +++ b/tests/ChangeLog Thu Mar 18 10:19:08 2010 -0500 @@ -1,3 +1,10 @@ +2010-03-18 Ben Wing + + * automated/c-tests.el: + * automated/c-tests.el (when): + Use `with-temp-buffer' so results don't get written into source + file. + 2010-03-12 Ben Wing * automated/base64-tests.el (bt-base64-encode-string): diff -r c97dc3b6de63 -r 6bff4f219697 tests/automated/c-tests.el --- a/tests/automated/c-tests.el Thu Mar 18 10:17:13 2010 -0500 +++ b/tests/automated/c-tests.el Thu Mar 18 10:19:08 2010 -0500 @@ -1,4 +1,5 @@ ;; Copyright (C) 2000 Martin Buchholz +;; Copyright (C) 2010 Ben Wing. ;; Author: Martin Buchholz ;; Maintainer: Martin Buchholz @@ -38,8 +39,9 @@ (push (file-name-directory load-file-name) load-path)) (require 'test-harness)))) -(when (boundp 'test-function-list) ; Only if configure --debug - (loop for fun in test-function-list do - ;; #### I hope there's no way we can signal ... - (loop for result in (funcall fun) do - (Assert (nth 1 result) (nth 2 result) (nth 0 result))))) +(with-temp-buffer + (when (boundp 'test-function-list) ; Only if configure --debug + (loop for fun in test-function-list do + ;; #### I hope there's no way we can signal ... + (loop for result in (funcall fun) do + (Assert (nth 1 result) (nth 2 result) (nth 0 result))))))