mirror of
https://github.com/frida/tinycc
synced 2024-11-28 02:29:38 +03:00
tests2: fix and enable 46_grep test.
This commit is contained in:
parent
0a51386960
commit
aa255f37f2
@ -15,6 +15,7 @@
|
|||||||
* privileges were granted by DECUS.
|
* privileges were granted by DECUS.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* grep
|
* grep
|
||||||
@ -25,7 +26,6 @@
|
|||||||
* See below for more information.
|
* See below for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if 0
|
|
||||||
char *documentation[] = {
|
char *documentation[] = {
|
||||||
"grep searches a file for a given pattern. Execute by",
|
"grep searches a file for a given pattern. Execute by",
|
||||||
" grep [flags] regular_expression file_list\n",
|
" grep [flags] regular_expression file_list\n",
|
||||||
@ -70,7 +70,6 @@ char *patdoc[] = {
|
|||||||
" [a-z] matches alphabetics, while [z-a] never matches.",
|
" [a-z] matches alphabetics, while [z-a] never matches.",
|
||||||
"The concatenation of regular expressions is a regular expression.",
|
"The concatenation of regular expressions is a regular expression.",
|
||||||
0};
|
0};
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LMAX 512
|
#define LMAX 512
|
||||||
#define PMAX 256
|
#define PMAX 256
|
||||||
@ -97,6 +96,10 @@ char *pp, lbuf[LMAX], pbuf[PMAX];
|
|||||||
|
|
||||||
char *cclass();
|
char *cclass();
|
||||||
char *pmatch();
|
char *pmatch();
|
||||||
|
void store(int);
|
||||||
|
void error(char *);
|
||||||
|
void badpat(char *, char *, char *);
|
||||||
|
int match(void);
|
||||||
|
|
||||||
|
|
||||||
/*** Display a file name *******************************/
|
/*** Display a file name *******************************/
|
||||||
@ -300,7 +303,7 @@ void badpat(char *message, char *source, char *stop)
|
|||||||
/* char *stop; // Pattern end */
|
/* char *stop; // Pattern end */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "-GREP-E-%s, pattern is\"%s\"\n", message, source);
|
fprintf(stderr, "-GREP-E-%s, pattern is\"%s\"\n", message, source);
|
||||||
fprintf(stderr, "-GREP-E-Stopped at byte %d, '%c'\n",
|
fprintf(stderr, "-GREP-E-Stopped at byte %ld, '%c'\n",
|
||||||
stop-source, stop[-1]);
|
stop-source, stop[-1]);
|
||||||
error("?GREP-E-Bad pattern\n");
|
error("?GREP-E-Bad pattern\n");
|
||||||
}
|
}
|
||||||
@ -338,7 +341,7 @@ void grep(FILE *fp, char *fn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*** Match line (lbuf) with pattern (pbuf) return 1 if match ***/
|
/*** Match line (lbuf) with pattern (pbuf) return 1 if match ***/
|
||||||
void match()
|
int match()
|
||||||
{
|
{
|
||||||
char *l; /* Line pointer */
|
char *l; /* Line pointer */
|
||||||
|
|
||||||
@ -368,7 +371,7 @@ char *pmatch(char *line, char *pattern)
|
|||||||
p = pattern;
|
p = pattern;
|
||||||
while ((op = *p++) != ENDPAT) {
|
while ((op = *p++) != ENDPAT) {
|
||||||
if (debug > 1)
|
if (debug > 1)
|
||||||
printf("byte[%d] = 0%o, '%c', op = 0%o\n",
|
printf("byte[%ld] = 0%o, '%c', op = 0%o\n",
|
||||||
l-line, *l, *l, op);
|
l-line, *l, *l, op);
|
||||||
switch(op) {
|
switch(op) {
|
||||||
|
|
||||||
|
3
tests/tests2/46_grep.expect
Normal file
3
tests/tests2/46_grep.expect
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
File 46_grep.c:
|
||||||
|
/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
|
||||||
|
|
@ -84,11 +84,9 @@ TESTS = \
|
|||||||
66_macro_concat_end.test \
|
66_macro_concat_end.test \
|
||||||
67_macro_concat.test
|
67_macro_concat.test
|
||||||
|
|
||||||
# 30_hanoi.test -- seg fault in the code, gcc as well
|
|
||||||
# 34_array_assignment.test -- array assignment is not in C standard
|
# 34_array_assignment.test -- array assignment is not in C standard
|
||||||
# 46_grep.test -- does not compile even with gcc
|
|
||||||
|
|
||||||
SKIP = 34_array_assignment.test 46_grep.test
|
SKIP = 34_array_assignment.test
|
||||||
|
|
||||||
# some tests do not pass on all platforms, remove them for now
|
# some tests do not pass on all platforms, remove them for now
|
||||||
ifeq ($(TARGETOS),Darwin)
|
ifeq ($(TARGETOS),Darwin)
|
||||||
@ -102,6 +100,7 @@ endif
|
|||||||
# Some tests might need arguments
|
# Some tests might need arguments
|
||||||
ARGS =
|
ARGS =
|
||||||
31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
|
31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
|
||||||
|
46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' 46_grep.c
|
||||||
|
|
||||||
all test: $(filter-out $(SKIP),$(TESTS))
|
all test: $(filter-out $(SKIP),$(TESTS))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user