Fix frame-call-representation for primitive applications
[bpt/guile.git] / test-suite / tests / c-api.test
1 ;;;; c-api.test --- complementary test suite for the c-api -*- scheme -*-
2 ;;;; MDJ 990915 <djurfeldt@nada.kth.se>
3 ;;;;
4 ;;;; Copyright (C) 1999, 2006, 2012 Free Software Foundation, Inc.
5 ;;;;
6 ;;;; This library is free software; you can redistribute it and/or
7 ;;;; modify it under the terms of the GNU Lesser General Public
8 ;;;; License as published by the Free Software Foundation; either
9 ;;;; version 3 of the License, or (at your option) any later version.
10 ;;;;
11 ;;;; This library is distributed in the hope that it will be useful,
12 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ;;;; Lesser General Public License for more details.
15 ;;;;
16 ;;;; You should have received a copy of the GNU Lesser General Public
17 ;;;; License along with this library; if not, write to the Free Software
18 ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
20 (use-modules (test-suite lib))
21
22 (define srcdir (cdr (assq 'srcdir %guile-build-info)))
23
24 (define (egrep string filename)
25 (zero? (system (string-append "egrep '" string "' " filename " >/dev/null"))))
26
27 (define (seek-offset-test dirname)
28 (let ((dir (opendir dirname)))
29 (do ((filename (readdir dir) (readdir dir)))
30 ((eof-object? filename))
31 (if (and
32 (eqv? (string-ref filename (- (string-length filename) 1)) #\c)
33 (eqv? (string-ref filename (- (string-length filename) 2)) #\.))
34 (let ((file (string-append dirname "/" filename)))
35 (if (and (file-exists? file)
36 (egrep "SEEK_(SET|CUR|END)" file))
37 (pass-if file (egrep "unistd.h" file))))))))
38
39 ;;; A rough conservative test to check that all source files
40 ;;; which use SEEK_SET, SEEK_CUR, and SEEK_END include unistd.h.
41 ;;;
42 ;;; If this test start to trigger without reason, we just modify it
43 ;;; to be more precise.
44 (with-test-prefix "SEEK_XXX => #include <unistd.h>"
45 (if (file-exists? srcdir)
46 (seek-offset-test srcdir)))