aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-07-29 00:49:53 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-07-29 00:49:53 +0300
commit07e8fc8a6afe790f7e225601392cf6d17b6a3591 (patch)
tree8d11d1574df20477a8f7359cb0403511948add3a /tests
parentc675f974b1787097237be644f77ba1d40385e425 (diff)
downloadidest-07e8fc8a6afe790f7e225601392cf6d17b6a3591.tar.gz
idest-07e8fc8a6afe790f7e225601392cf6d17b6a3591.tar.bz2
Add testsuite
* Makefile.am (SUBDIRS): Add tests * configure.ac: Initialize testsuite. * src/cmdline.opt (get_options): Bugfix. * src/frametab.gperf: Use condesc instead of descr, which is reserved. * src/getopt.m4: Fix version output. * src/guile.c: Bugfixes. * src/main.c (guile_argv): Declare here, instead of in guile.c. * tests/Makefile.am: New file. * tests/testsuite.at: New file. * tests/.gitignore: New file. * tests/Makefile.am: New file. * tests/atlocal.in: New file. * tests/genfile.c: New file. * tests/id3v1: New file. * tests/id3v1-2: New file. * tests/id3v2: New file. * tests/idest-32.png: New file. * tests/idest-68.png: New file. * tests/info-v1-00.at: New file. * tests/info-v12-00.at: New file. * tests/info-v2-00.at: New file. * tests/query-v1-00.at: New file. * tests/query-v1-01.at: New file. * tests/query-v2-00.at: New file. * tests/query-v2-01.at: New file. * tests/query-v2-02.at: New file. * tests/query-v2-03.at: New file. * tests/query-v2-04.at: New file. * tests/set-v1-00.at: New file. * tests/set-v2-00.at: New file. * tests/version.at: New file.
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore7
-rw-r--r--tests/Makefile.am95
-rw-r--r--tests/atlocal.in10
-rw-r--r--tests/genfile.c128
-rw-r--r--tests/id3v1bin0 -> 128 bytes
-rw-r--r--tests/id3v1-2bin0 -> 2081 bytes
-rw-r--r--tests/id3v2bin0 -> 1953 bytes
-rw-r--r--tests/idest-32.pngbin0 -> 314 bytes
-rw-r--r--tests/idest-68.pngbin0 -> 419 bytes
-rw-r--r--tests/info-v1-00.at33
-rw-r--r--tests/info-v12-00.at36
-rw-r--r--tests/info-v2-00.at33
-rw-r--r--tests/query-v1-00.at35
-rw-r--r--tests/query-v1-01.at31
-rw-r--r--tests/query-v2-00.at35
-rw-r--r--tests/query-v2-01.at31
-rw-r--r--tests/query-v2-02.at31
-rw-r--r--tests/query-v2-03.at34
-rw-r--r--tests/query-v2-04.at52
-rw-r--r--tests/set-v1-00.at52
-rw-r--r--tests/set-v2-00.at69
-rw-r--r--tests/testsuite.at42
-rw-r--r--tests/version.at34
23 files changed, 788 insertions, 0 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..11f17b8
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,7 @@
1atconfig
2atlocal
3genfile
4package.m4
5testsuite
6testsuite.dir
7testsuite.log
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..4463d13
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,95 @@
1# This file is part of idest
2# Copyright (C) 2011 Sergey Poznyakoff
3#
4# Idest is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3, or (at your option)
7# any later version.
8#
9# Idest is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with idest. If not, see <http://www.gnu.org/licenses/>.
16
17EXTRA_DIST = \
18 $(TESTSUITE_AT)\
19 testsuite\
20 package.m4\
21 id3v1\
22 id3v1-2\
23 id3v2
24
25DISTCLEANFILES = atconfig
26MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
27
28
29## ------------ ##
30## package.m4. ##
31## ------------ ##
32
33$(srcdir)/package.m4: $(top_srcdir)/configure.ac $(srcdir)/Makefile
34 $(AM_V_GEN){ \
35 echo '# Signature of the current package.'; \
36 echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
37 echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
38 echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
39 echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
40 echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
41 echo 'm4_define([AT_PACKAGE_GUILE], [@GUILE_VERSION@])'; \
42 } >$(srcdir)/package.m4
43
44#
45
46## ------------ ##
47## Test suite. ##
48## ------------ ##
49
50TESTSUITE_AT = \
51 testsuite.at\
52 version.at\
53 info-v1-00.at\
54 info-v2-00.at\
55 info-v12-00.at\
56 set-v1-00.at\
57 set-v2-00.at\
58 query-v1-00.at\
59 query-v1-01.at\
60 query-v2-00.at\
61 query-v2-01.at\
62 query-v2-02.at\
63 query-v2-03.at\
64 query-v2-04.at
65
66TESTSUITE = $(srcdir)/testsuite
67M4=m4
68
69AUTOTEST = $(AUTOM4TE) --language=autotest
70$(TESTSUITE): package.m4 $(TESTSUITE_AT)
71 $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
72 mv $@.tmp $@
73
74atconfig: $(top_builddir)/config.status
75 cd $(top_builddir) && ./config.status tests/$@
76
77clean-local:
78 test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
79
80check-local: atconfig atlocal $(TESTSUITE)
81 $(SHELL) $(TESTSUITE)
82
83# Run the test suite on the *installed* tree.
84#installcheck-local:
85# $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
86
87## ------------ ##
88## genfile ##
89## ------------ ##
90
91check_PROGRAMS = genfile
92
93genfile_SOURCES = genfile.c
94
95
diff --git a/tests/atlocal.in b/tests/atlocal.in
new file mode 100644
index 0000000..420c2c9
--- /dev/null
+++ b/tests/atlocal.in
@@ -0,0 +1,10 @@
1# @configure_input@ -*- shell-script -*-
2# Configurable variable values for the Idest test suite.
3# Copyright (C) 2011 Sergey Poznyakoff
4
5PATH=@abs_top_builddir@/src:$PATH
6
7XFAILFILE=$abs_builddir/.badversion
8
9trap "cleanup; test -r $XFAILFILE && cat $XFAILFILE; exit $?" 1 2 13 15
10
diff --git a/tests/genfile.c b/tests/genfile.c
new file mode 100644
index 0000000..26b046f
--- /dev/null
+++ b/tests/genfile.c
@@ -0,0 +1,128 @@
1/* This file is part of Idest.
2 Copyright (C) 2009-2011 Sergey Poznyakoff
3
4 Idest is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 Idest is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with Idest. If not, see <http://www.gnu.org/licenses/>. */
16
17#ifdef HAVE_CONFIG_H
18# include <config.h>
19#endif
20#include <stdlib.h>
21#include <stdio.h>
22#include <unistd.h>
23#ifdef HAVE_GETOPT_H
24# include <getopt.h>
25#endif
26
27static void
28copyfile(FILE *file, const char *name)
29{
30 int c;
31 FILE *in = fopen(name, "r");
32 if (!in) {
33 perror(name);
34 exit(1);
35 }
36 while ((c = fgetc(in)) != EOF)
37 fputc(c, file);
38 fclose(in);
39}
40
41int
42main(int argc, char **argv)
43{
44 char *suf;
45 unsigned int length, i, c;
46 char *filename = NULL, *suffix = NULL, *prefix = NULL;
47 FILE *fp;
48
49 while ((c = getopt(argc, argv, "hf:p:s:")) != EOF) {
50 switch (c) {
51 case 'f':
52 filename = optarg;
53 break;
54
55 case 'p':
56 prefix = optarg;
57 break;
58
59 case 's':
60 suffix = optarg;
61 break;
62
63 case 'h':
64 fprintf(stdout,
65 "usage: %s [-f FILE] [-p PREFIX]"
66 " [-s SUFFIX] SIZE\n", argv[0]);
67 exit(0);
68
69 default:
70 exit(1);
71 }
72 }
73
74 if (optind + 1 != argc) {
75 fprintf(stderr, "%s: invalid usage\n", argv[0]);
76 exit(1);
77 }
78
79 length = strtoul(argv[optind], &suf, 10);
80 if (suf[0] && suf[1]) {
81 fprintf(stderr, "%s: unknown size suffix: %s\n", argv[0], suf);
82 exit(1);
83 }
84
85 switch (*suf) {
86 case 0:
87 break;
88 case 'g':
89 case 'G':
90 length *= 1024;