Commit c9813dd2 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Add [] to promote a specific test (or to add a new test).

parent 344d760f
Pipeline #115995 passed with stages
in 25 seconds
......@@ -55,10 +55,15 @@ speed:
@ dune build --workspace dune-workspace.versions @all @test
# [make expected] updates the contents of the reference files (those
# [make expected] updates the contents of *all* reference files (those
# that contain the expected output of every test). This command should
# be run only when you trust that every test produces correct output.
# [make expected] can *update* existing reference files, but will not
# *create* them when they do not exist. Also, it updates *all* files;
# it cannot be used to refresh a few specific files. Both of these
# limitations can be worked around by using the script [].
.PHONY: expected
@ dune build @test --auto-promote
set -euo pipefail
# This script promotes a specific test, named on the command line.
# To promote a test means to create or update its expected-output files.
# Examples:
# ./ good/mezzo
# ./ bad/option
# If this is a newly created test, then [make depend] should be run first
# for dune to know about this test.
for name in "$@"
if [[ $name =~ ^good/.* ]] ; then
# A positive test.
echo "Promoting $name..."
# Create the expected-output files if they are missing.
touch test/static/$name.opp.exp
touch test/static/$name.exp
# Ask dune to update the expected-output files.
dune build @$base --auto-promote
elif [[ $name =~ ^bad/.* ]] ; then
# A negative test.
echo "Promoting $name..."
# Create the expected-output file if it is missing.
touch test/static/$name.expected
# Ask dune to update the expected-output file.
dune build @$base --auto-promote
# Unrecognized.
echo "Don't know what to do with '$name'."
echo "This script handles tests whose name begins with good/ or bad/."
exit 1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment