Makefile.am: add check_sizeof and testischar

This commit is contained in:
rocky
2003-08-17 06:32:45 +00:00
parent dcaa75595a
commit 604b3f102a
3 changed files with 77 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ Makefile.in
check_cue.sh check_cue.sh
check_common_fn check_common_fn
check_nrg.sh check_nrg.sh
check_sizeof
testassert testassert
testischar testischar
*.dump *.dump

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.4 2003/08/17 05:31:19 rocky Exp $ # $Id: Makefile.am,v 1.5 2003/08/17 06:32:45 rocky Exp $
# #
# Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> # Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
# #
@@ -20,12 +20,13 @@
# Things to regression testing # Things to regression testing
#################################################### ####################################################
# #
noinst_PROGRAMS = testassert testischar noinst_PROGRAMS = testassert testischar check_sizeof
INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS) INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS)
testassert_LDADD = $(LIBCDIO_LIBS) testassert_LDADD = $(LIBCDIO_LIBS)
testischar_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) testischar_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
check_sizeof_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
check_SCRIPTS = check_nrg.sh check_cue.sh check_opts.sh check_SCRIPTS = check_nrg.sh check_cue.sh check_opts.sh
@@ -43,6 +44,6 @@ EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \
check_common_fn check_cue.sh.in check_nrg.sh.in check_common_fn check_cue.sh.in check_nrg.sh.in
TESTS_ENVIRONMENT=$(SHELL) TESTS_ENVIRONMENT=$(SHELL)
TESTS = $(check_SCRIPTS) TESTS = testischar check_sizeof $(check_SCRIPTS)
MOSTLYCLEANFILES = core.* *.dump MOSTLYCLEANFILES = core.* *.dump

72
test/check_sizeof.c Normal file
View File

@@ -0,0 +1,72 @@
/*
$Id: check_sizeof.c,v 1.1 2003/08/17 06:32:45 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <cdio/iso9660.h>
#include <cdio/types.h>
/* Private headers */
#include "iso9660_private.h"
#define CHECK_SIZEOF(typnam) { \
printf ("checking sizeof (%s) ...", #typnam); \
if (sizeof (typnam) != (typnam##_SIZEOF)) { \
printf ("failed!\n==> sizeof (%s) == %d (but should be %d)\n", \
#typnam, (int)sizeof(typnam), (int)(typnam##_SIZEOF)); \
fail++; \
} else { pass++; printf ("ok!\n"); } \
}
#define CHECK_SIZEOF_STRUCT(typnam) { \
printf ("checking sizeof (struct %s) ...", #typnam); \
if (sizeof (struct typnam) != (struct_##typnam##_SIZEOF)) { \
printf ("failed!\n==> sizeof (struct %s) == %d (but should be %d)\n", \
#typnam, (int)sizeof(struct typnam), (int)(struct_##typnam##_SIZEOF)); \
fail++; \
} else { pass++; printf ("ok!\n"); } \
}
int main (int argc, const char *argv[])
{
unsigned fail = 0, pass = 0;
/* <cdio/types.h> */
CHECK_SIZEOF(msf_t);
/* "iso9660_private.h" */
CHECK_SIZEOF_STRUCT(iso_volume_descriptor);
CHECK_SIZEOF_STRUCT(iso_primary_descriptor);
CHECK_SIZEOF_STRUCT(iso_path_table);
CHECK_SIZEOF_STRUCT(iso_directory_record);
if (fail)
return 1;
return 0;
}