Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
POTTIER Francois
menhir
Commits
edb92949
Commit
edb92949
authored
Mar 30, 2017
by
POTTIER Francois
Browse files
Remove the old good/Makefile and bad/Makefile.
parent
3a07b255
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/bad/Makefile
View file @
edb92949
.PHONY
:
clean
test
expected
.PHONY
:
test
clean expected
# Note that there is potential confusion between src/_stage1/menhir
# and src/_stage2/menhir. Here, we use the latter (built by "make
# bootstrap" in the src/ directory). But typing "make" in the src/
# directory re-builds only the former.
# ------------------------------------------------------------------------------
# The test scripts are now written in OCaml.
SHELL
=
/bin/bash
SRC
=
../../src
MENHIR
=
$(SRC)
/_stage2/menhir.native
--stdlib
$(SRC)
test expected
:
@
$(MAKE)
-C
../src
test
# La convention de nommage des tests multi-grammaires
# est : /nom/-[1-9].mly
TESTS
=
$(
shell
ls
*
.mly | egrep
'.*([1]|[^2-9]
)
.mly'
)
RESULTS
=
$(TESTS:.mly=.result)
test
:
clean $(RESULTS)
@
if
test
-e
failed_files
;
then
\
echo
FAILED ON:
;
\
cat
failed_files
;
\
fi
%.result
:
%.mly
# Check if there is a group of several .mly files, or just one .mly file.
@
if
echo
$<
|
grep
-e
"-1.mly"
&>
/dev/null;
then
\
export
BASE
=
`
echo
$<
|
sed
s/
"-1.mly"
/
""
/
`
;
\
export
FILES
=
`
echo
$$
BASE-[1-9].mly
`
;
\
export
CMD
=
"
$$
FILES --base
$$
BASE"
;
\
else
\
export
FILES
=
"
$<
"
;
\
export
CMD
=
"
$<
"
;
\
fi
;
\
if
$(MENHIR)
$$
CMD
>
& /dev/null
;
then
\
echo
"-> [KO] menhir should not accept
$$
FILES"
;
\
export
FAILED_FILES
=
"
$$
FAILED_FILES
$$
FILES"
;
\
else
\
$(SHELL)
-c
'
$(MENHIR)
$$CMD >& $@'
;
\
if
[
x
$$
CREATE_EXPECTED
==
x
"1"
]
;
then
\
cp
$@
$*
.expected
;
\
fi
;
\
if
[
x
$$
VERBOSE
==
x
"1"
]
;
then
\
echo
"********************************************************"
;
\
echo
"* INPUT"
;
\
echo
"********************************************************"
;
\
cat
$<
;
\
echo
"********************************************************"
;
\
echo
"* OUTPUT"
;
\
echo
"********************************************************"
;
\
cat
$@
;
\
echo
""
;
\
fi
;
\
if
test
-e
$*
.expected
;
then
\
if
diff
$@
$*
.expected
>
& /dev/null
;
then
\
echo
"[OK]
$$
FILES"
;
\
else
\
echo
"-> [KO] menhir gives bad error message on
$$
FILES"
;
\
echo
"
$$
FILES"
>>
failed_files
;
\
fi
;
\
else
\
echo
"[OK]
$$
FILES"
;
\
fi
;
\
fi
# TEMPORARY il faudrait pouvoir construire les fichiers .expected un par un
expected
:
@
echo
"Are you sure ? (this will erase *.expected) [Press ENTER]"
@
read
@
mkdir
-p
/tmp/mini-expected
@
cp
-f
*
.expected /tmp/mini-expected
>
& /dev/null
||
true
@
CREATE_EXPECTED
=
1
$(MAKE)
-s
test
@
echo
"Expected output re-generated."
# Use "make -B foo.expected" to force the reconstruction.
%.expected
:
@
echo
"Are you sure ? (this will erase
$@
) [Press ENTER]"
@
read
@
CREATE_EXPECTED
=
1
$(MAKE)
$*
.result
clean
:
rm
-f
*
.ml
*
.mli
*
.conflicts
*
.automaton
*
.cmi
*
.cmo
*
.cmx
*
.o
*
.s
*
.result
*
~ failed_files
clean
::
rm
-f
*
~
*
.ml
*
.mli
*
.conflicts
*
.automaton
rm
-f
*
.result
test/good/Makefile
View file @
edb92949
.PHONY
:
clean
test expected list
.PHONY
:
test expected
clean
list
# Note that there is potential confusion between src/_stage1/menhir
# and src/_stage2/menhir. Here, we use the latter (built by "make
# bootstrap" in the src/ directory). But typing "make" in the src/
# directory re-builds only the former.
SHELL
=
/bin/bash
SRC
=
../../src
MENHIR
=
$(SRC)
/_stage2/menhir.native
--dump
--explain
--stdlib
$(SRC)
# Some tests involve several input files. The naming convention for
# these tests is /name/-[1-9].mly.
TESTS
=
$(
shell
ls
*
.mly | egrep
'.*([1]|[^2-9]
)
.mly'
)
RESULTS
=
$(TESTS:.mly=.opp.out)
test
:
clean $(RESULTS)
@
if
test
-e
warnings
;
then
\
echo
WARNINGS:
;
\
cat
warnings
;
\
fi
@
if
test
-e
failures
;
then
\
echo
FAILURES:
;
\
cat
failures
;
\
exit
1
;
\
fi
# The file %.flags (if it exists) stores extra flags that should be passed to Menhir.
# The file %.opp.out stores the output of menhir --only-preprocess.
# The file %.opp.exp stores its expected output.
# The file %.out stores the output of menhir.
# The file %.exp stores its expected output.
%.opp.out
:
%.mly
@
if
echo
$<
|
grep
-e
"-1.mly"
&> /dev/null
;
then
\
export
BASE
=
`
echo
$<
|
sed
s/
"-1.mly"
/
""
/
`
;
\
export
FILES
=
`
echo
$$
BASE-[1-9].mly
`
;
\
export
CMD
=
"
$$
FILES --base
$$
BASE"
;
\
else
\
export
FILES
=
"
$<
"
;
\
export
BASE
=
`
echo
$<
|
sed
s/
".mly"
/
""
/
`
;
\
export
CMD
=
"
$<
"
;
\
fi
;
\
if
[
-f
$*
.flags
]
;
then
\
export
CMD
=
"
$$
CMD
`
cat
$*
.flags
`
"
;
\
fi
;
\
$(SHELL)
-c
'
$(MENHIR)
--only-preprocess $$CMD >& $@'
;
\
if
[
x
$$
CREATE_EXPECTED
==
x
"1"
]
;
then
\
cp
$@
$*
.opp.exp
;
\
fi
;
\
if
test
-e
$*
.opp.exp
;
then
\
if
diff
$@
$*
.opp.exp
>
& /dev/null
;
then
\
if
$(MENHIR)
--explain
$$
CMD
>
&
$*
.out
;
then
\
if
[
x
$$
CREATE_EXPECTED
==
x
"1"
]
;
then
\
cp
$*
.out
$*
.exp
;
\
fi
;
\
if
test
-e
$*
.exp
;
then
\
if
!
diff
$*
.exp
$*
.out
>
& /dev/null
;
then
(
\
echo
"-> [KO]
$$
FILES:"
;
\
echo
" menhir produced wrong output."
;
\
echo
" diff
$*
.exp
$*
.out"
;
\
)
|
tee
-a
failures
;
\
else
\
echo
"[OK]
$$
FILES"
;
\
fi
;
\
else
\
echo
"Warning: missing file:
$*
.exp"
|
tee
-a
warnings
;
\
fi
;
\
else
\
if
!
grep
$*
00KNOWN_FAILURES
>
& /dev/null
;
then
(
\
echo
"-> [KO]
$$
FILES:"
;
\
echo
" menhir --only-preprocess succeeded,"
;
\
echo
" but menhir failed."
;
\
echo
" more
$*
.out"
;
\
)
|
tee
-a
failures
;
\
else
\
echo
"-> [KO]
$$
FILES:"
;
\
echo
" known failure."
;
\
fi
;
\
fi
;
\
else
(
\
echo
"-> [KO]
$$
FILES:"
;
\
echo
" menhir --only-preprocess produced wrong output."
;
\
echo
" diff
$*
.opp.exp
$@
"
;
\
)
|
tee
-a
failures
;
\
fi
;
\
else
\
echo
"Warning: missing file:
$*
.opp.exp"
|
tee
-a
warnings
;
\
fi
;
\
# ------------------------------------------------------------------------------
# The test scripts are now written in OCaml.
expected
:
@
echo
"Are you sure ? (this will erase *.exp) [Press ENTER]"
@
read
@
mkdir
-p
/tmp/menhir-expected
@
cp
*
.exp /tmp/menhir-expected
>
& /dev/null
||
true
@
CREATE_EXPECTED
=
1
$(MAKE)
-s
test
@
echo
"Expected output re-generated."
test expected
:
@
$(MAKE)
-C
../src
test
clean
::
rm
-f
*
~
rm
-f
*
.ml
*
.mli
*
.conflicts
*
.automaton
rm
-f
*
.out failures warnings
rm
-f
*
~
*
.ml
*
.mli
*
.conflicts
*
.automaton
rm
-f
*
.out
# ------------------------------------------------------------------------------
# Testing LRijkstra, that is, menhir --list-errors.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment