unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Test coverage of libguile
@ 2009-10-28 17:56 Ludovic Courtès
  2009-10-28 20:58 ` Neil Jerram
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2009-10-28 17:56 UTC (permalink / raw)
  To: guile-devel

Hello Guilers!

I set up Nix/Hydra to build code coverage reports for 1.9:

  http://hydra.nixos.org/job/nixpkgs/guile2test/guile_1_9_coverage/all

The meat is here:

  http://hydra.nixos.org/build/106916/download/1/coverage/libguile/index-sort-l.html

In short, we have a number of red boxes that it would be nice to
decrease.  :-)

We really need a similar tool for Scheme code now.

Thanks,
Ludo’.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Test coverage of libguile
  2009-10-28 17:56 Test coverage of libguile Ludovic Courtès
@ 2009-10-28 20:58 ` Neil Jerram
  2009-10-28 21:11   ` Andy Wingo
  2009-11-03 21:53   ` Neil Jerram
  0 siblings, 2 replies; 6+ messages in thread
From: Neil Jerram @ 2009-10-28 20:58 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

ludo@gnu.org (Ludovic Courtès) writes:

> Hello Guilers!
>
> I set up Nix/Hydra to build code coverage reports for 1.9:
>
>   http://hydra.nixos.org/job/nixpkgs/guile2test/guile_1_9_coverage/all
>
> The meat is here:
>
>   http://hydra.nixos.org/build/106916/download/1/coverage/libguile/index-sort-l.html
>
> In short, we have a number of red boxes that it would be nice to
> decrease.  :-)

Fantastic stuff.  I had a very quick look at some of the unhit code, and
in many cases it would only take a few minutes to write a test to cover
it.  I will do some of that myself, but patches are welcome from
everyone!  (Less than 10 lines doesn't need copyright assignment...)

> We really need a similar tool for Scheme code now.

Indeed that would be good.  Any idea how?

       Neil




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Test coverage of libguile
  2009-10-28 20:58 ` Neil Jerram
@ 2009-10-28 21:11   ` Andy Wingo
  2009-11-03 21:53   ` Neil Jerram
  1 sibling, 0 replies; 6+ messages in thread
From: Andy Wingo @ 2009-10-28 21:11 UTC (permalink / raw)
  To: Neil Jerram; +Cc: Ludovic Courtès, guile-devel

On Wed 28 Oct 2009 21:58, Neil Jerram <neil@ossau.uklinux.net> writes:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> We really need a similar tool for Scheme code now.
>
> Indeed that would be good.  Any idea how?

The VM has hooks that can run at every VM operation. Simply tabulate the
frame's procedure and the IP and you can do it. But the tracing
interface needs some love -- for example, so that the hooks run with
tracing off :)

Andy
-- 
http://wingolog.org/




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Test coverage of libguile
  2009-10-28 20:58 ` Neil Jerram
  2009-10-28 21:11   ` Andy Wingo
@ 2009-11-03 21:53   ` Neil Jerram
  2009-11-03 23:13     ` Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: Neil Jerram @ 2009-11-03 21:53 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

Neil Jerram <neil@ossau.uklinux.net> writes:

> it.  I will do some of that myself, but patches are welcome from
> everyone!  (Less than 10 lines doesn't need copyright assignment...)

Attached, for review, are some new tests for continuations and keywords.

      Neil


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fill-code-coverage-holes-in-continuations.c-and-keyw.patch --]
[-- Type: text/x-diff, Size: 6263 bytes --]

From fb907a1c4b2b579045b630565772f2567f23230a Mon Sep 17 00:00:00 2001
From: Neil Jerram <neil@ossau.uklinux.net>
Date: Tue, 3 Nov 2009 21:51:28 +0000
Subject: [PATCH] Fill code coverage holes in continuations.c and keywords.c

* test-suite/Makefile.am (SCM_TESTS): Add tests/keywords.test.

* test-suite/standalone/Makefile.am (test-loose-ends): New test.

* test-suite/standalone/test-loose-ends.c: New file.

* test-suite/tests/continuations.test: Three new tests.

* test-suite/tests/keywords.test: New file.
---
 test-suite/Makefile.am                  |    1 +
 test-suite/standalone/Makefile.am       |    7 ++++
 test-suite/standalone/test-loose-ends.c |   56 +++++++++++++++++++++++++++++++
 test-suite/tests/continuations.test     |   28 +++++++++++++++
 test-suite/tests/keywords.test          |   30 ++++++++++++++++
 5 files changed, 122 insertions(+), 0 deletions(-)
 create mode 100644 test-suite/standalone/test-loose-ends.c
 create mode 100644 test-suite/tests/keywords.test

diff --git a/test-suite/Makefile.am b/test-suite/Makefile.am
index 145975c..d08aab7 100644
--- a/test-suite/Makefile.am
+++ b/test-suite/Makefile.am
@@ -48,6 +48,7 @@ SCM_TESTS = tests/alist.test			\
 	    tests/i18n.test			\
 	    tests/import.test			\
 	    tests/interp.test			\
+	    tests/keywords.test			\
 	    tests/list.test			\
 	    tests/load.test			\
 	    tests/modules.test			\
diff --git a/test-suite/standalone/Makefile.am b/test-suite/standalone/Makefile.am
index 1b0d9d6..17ac1e7 100644
--- a/test-suite/standalone/Makefile.am
+++ b/test-suite/standalone/Makefile.am
@@ -107,6 +107,13 @@ test_conversion_LDADD = ${top_builddir}/libguile/libguile.la
 check_PROGRAMS += test-conversion
 TESTS += test-conversion
 
+# test-loose-ends
+test_loose_ends_SOURCES = test-loose-ends.c
+test_loose_ends_CFLAGS = ${test_cflags}
+test_loose_ends_LDADD = ${top_builddir}/libguile/libguile.la
+check_PROGRAMS += test-loose-ends
+TESTS += test-loose-ends
+
 # test-fast-slot-ref
 check_SCRIPTS += test-fast-slot-ref
 TESTS += test-fast-slot-ref
diff --git a/test-suite/standalone/test-loose-ends.c b/test-suite/standalone/test-loose-ends.c
new file mode 100644
index 0000000..2fdbe7d
--- /dev/null
+++ b/test-suite/standalone/test-loose-ends.c
@@ -0,0 +1,56 @@
+/* test-loose-ends.c
+ *
+ * Test items of the Guile C API that aren't covered by any other tests.
+ */
+
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libguile.h>
+
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
+
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+static void
+test_scm_from_locale_keywordn ()
+{
+  SCM kw = scm_from_locale_keywordn ("thusly", 4);
+  assert (scm_is_true (scm_keyword_p (kw)));
+}
+
+static void
+tests (void *data, int argc, char **argv)
+{
+  test_scm_from_locale_keywordn ();
+}
+
+int
+main (int argc, char *argv[])
+{
+  scm_boot_guile (argc, argv, tests, NULL);
+  return 0;
+}
diff --git a/test-suite/tests/continuations.test b/test-suite/tests/continuations.test
index 20a7a5a..d96274e 100644
--- a/test-suite/tests/continuations.test
+++ b/test-suite/tests/continuations.test
@@ -52,6 +52,34 @@
   (pass-if "throwing to a rewound catch context"
     (eq? (dont-crash-please) 'no-reentry))
 
+  (pass-if "can print a continuation"
+    (let ((s (with-output-to-string
+	       (lambda ()
+		 (call-with-current-continuation write)))))
+      (string=? "#<continuation " (substring s 0 15))))
+
+  (pass-if "blocked attempt to cross a continuation barrier"
+    (call-with-current-continuation
+     (lambda (k)
+       (with-continuation-barrier
+	(lambda ()
+	  (catch 'misc-error
+		 (lambda ()
+		   (k 1)
+		   #f)
+		 (lambda _
+		   #t)))))))
+
+  (pass-if "uncaught exception is handled by continuation barrier"
+    (let* ((handled #f)
+	   (s (with-error-to-string
+	       (lambda ()
+		 (set! handled
+		       (not (with-continuation-barrier
+			     (lambda ()
+			       (error "Catch me if you can!")))))))))
+      handled))
+
   (with-debugging-evaluator
 
     (pass-if "make a stack from a continuation"
diff --git a/test-suite/tests/keywords.test b/test-suite/tests/keywords.test
new file mode 100644
index 0000000..78053ad
--- /dev/null
+++ b/test-suite/tests/keywords.test
@@ -0,0 +1,30 @@
+;;;; keywords.test --- Keywords                  -*- Scheme -*-
+;;;;
+;;;; 	Copyright (C) 2009 Free Software Foundation, Inc.
+;;;;
+;;;; This library is free software; you can redistribute it and/or
+;;;; modify it under the terms of the GNU Lesser General Public
+;;;; License as published by the Free Software Foundation; either
+;;;; version 3 of the License, or (at your option) any later version.
+;;;; 
+;;;; This library is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;;;; Lesser General Public License for more details.
+;;;; 
+;;;; You should have received a copy of the GNU Lesser General Public
+;;;; License along with this library; if not, write to the Free Software
+;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+(define-module (test-keywords)
+  :use-module (test-suite lib))
+
+\f
+(with-test-prefix "keywords"
+  (pass-if "printing"
+    (string=? (with-output-to-string (lambda () (write #:this)))
+	      "#:this")))
+
+;;; Local Variables:
+;;; coding: latin-1
+;;; End:
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Test coverage of libguile
  2009-11-03 21:53   ` Neil Jerram
@ 2009-11-03 23:13     ` Ludovic Courtès
  2009-11-04  0:01       ` Neil Jerram
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2009-11-03 23:13 UTC (permalink / raw)
  To: Neil Jerram; +Cc: guile-devel

Hello,

Neil Jerram <neil@ossau.uklinux.net> writes:

> Attached, for review, are some new tests for continuations and keywords.

Looks good to me, thank you!

Ludo’.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Test coverage of libguile
  2009-11-03 23:13     ` Ludovic Courtès
@ 2009-11-04  0:01       ` Neil Jerram
  0 siblings, 0 replies; 6+ messages in thread
From: Neil Jerram @ 2009-11-04  0:01 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

ludo@gnu.org (Ludovic Courtès) writes:

> Hello,
>
> Neil Jerram <neil@ossau.uklinux.net> writes:
>
>> Attached, for review, are some new tests for continuations and keywords.
>
> Looks good to me, thank you!

Thanks for the review, this is pushed now.

     Neil




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-11-04  0:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-28 17:56 Test coverage of libguile Ludovic Courtès
2009-10-28 20:58 ` Neil Jerram
2009-10-28 21:11   ` Andy Wingo
2009-11-03 21:53   ` Neil Jerram
2009-11-03 23:13     ` Ludovic Courtès
2009-11-04  0:01       ` Neil Jerram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).