Rename expected, input and run

Because cabal's wildcards are broken and doesn't allow
files without file endings.
This commit is contained in:
Niklas Larsson 2020-01-25 00:51:38 +01:00
parent 1dd93169c9
commit b5a6637da8
561 changed files with 128 additions and 127 deletions

View File

@ -215,36 +215,6 @@ idrisConfigure _ flags pkgdesc local = do
autogenComponentModulesDir lbi _ = autogenModulesDir lbi
#endif
idrisPreSDist args flags = do
let dir = S.fromFlag (S.sDistDirectory flags)
let verb = S.fromFlag (S.sDistVerbosity flags)
generateVersionModule verb "src" True
generateBuildFlagsModule verb "src" []
generateTargetModule verb "src" "./libs"
generateToolchainModule verb "src" Nothing
preSDist simpleUserHooks args flags
idrisSDist sdist pkgDesc bi hooks flags = do
pkgDesc' <- addGitFiles pkgDesc
sdist pkgDesc' bi hooks flags
where
addGitFiles :: PackageDescription -> IO PackageDescription
addGitFiles pkgDesc = do
files <- gitFiles
return $ pkgDesc { extraSrcFiles = extraSrcFiles pkgDesc ++ files}
gitFiles :: IO [FilePath]
gitFiles = liftM lines (readProcess "git" ["ls-files"] "")
idrisPostSDist args flags desc lbi = do
Control.Exception.catch (do let file = "src" </> "Version_idris" Px.<.> "hs"
let targetFile = "src" </> "Target_idris" Px.<.> "hs"
putStrLn $ "Removing generated modules:\n "
++ file ++ "\n" ++ targetFile
removeFile file
removeFile targetFile)
(\e -> let e' = (e :: SomeException) in return ())
postSDist simpleUserHooks args flags desc lbi
#if !(MIN_VERSION_Cabal(2,0,0))
rewriteFileEx :: Verbosity -> FilePath -> String -> IO ()
rewriteFileEx _ = rewriteFile
@ -353,8 +323,5 @@ main = defaultMainWithHooks $ simpleUserHooks
, postInst = \_ flags pkg local ->
idrisInstall (S.fromFlag $ S.installVerbosity flags)
NoCopyDest pkg local
, preSDist = idrisPreSDist
, sDistHook = idrisSDist (sDistHook simpleUserHooks)
, postSDist = idrisPostSDist
, testHook = idrisTestHook
}

View File

@ -1,6 +1,7 @@
Cabal-Version: 2.4
Name: idris
Version: 1.3.2
License: BSD3
License: BSD-3-Clause
License-file: LICENSE
Author: Edwin Brady
Maintainer: Edwin Brady <eb@cs.st-andrews.ac.uk>
@ -41,42 +42,18 @@ Description: Idris is a general purpose language with full dependent types.
.
* Hugs style interactive environment
Cabal-Version: >= 1.22
Build-type: Custom
Tested-With: GHC == 7.10.3, GHC == 8.0.1
Data-files: idrisdoc/styles.css
jsrts/jsbn/jsbn-browser.js
jsrts/jsbn/jsbn-node.js
jsrts/Runtime-common.js
jsrts/Runtime-javascript.js
jsrts/Runtime-node.js
jsrts/**/*.js
jsrts/jsbn/LICENSE
rts/arduino/idris_main.c
rts/idris_bitstring.c
rts/idris_bitstring.h
rts/idris_gc.c
rts/idris_gc.h
rts/idris_gmp.c
rts/idris_gmp.h
rts/idris_heap.c
rts/idris_heap.h
rts/idris_main.c
rts/idris_net.c
rts/idris_net.h
rts/idris_opts.c
rts/idris_opts.h
rts/idris_rts.c
rts/idris_rts.h
rts/idris_stats.c
rts/idris_stats.h
rts/idris_stdfgn.c
rts/idris_stdfgn.h
rts/mini-gmp.c
rts/mini-gmp.h
rts/libtest.c
rts/Makefile
rts/**/*.c
rts/**/*.h
rts/seL4/CMakeLists.txt
rts/seL4/README.md
Extra-doc-files:
CHANGELOG.md
@ -86,13 +63,62 @@ Extra-doc-files:
README.md
RELEASE-CHECKS.md
idris-tutorial.pdf
samples/effects/*.idr
samples/misc/*.idr
samples/misc/*.lidr
samples/tutorial/*.idr
man/idris.1
samples/**/*.idr
samples/**/*.lidr
-- extra-source-files is generated by Setup.hs using `git --ls-files`.
Extra-source-files:
Makefile
config.mk
custom.mk-alldeps
mkpkg.sh
stack-alt.yaml
stack-shell.nix
stack.yaml
stylize.sh
win-release.sh
benchmarks/*.pl
benchmarks/**/*.idr
benchmarks/**/*.ipkg
benchmarks/quasigroups/board
icons/*.png
icons/*.ico
icons/*.rc
icons/*.svg
icons/*.xml
libs/**/*.idr
libs/**/*.ipkg
libs/**/*.txt
libs/Makefile
libs/base/Makefile
libs/contrib/Makefile
libs/effects/Makefile
libs/prelude/Makefile
libs/pruviloj/Makefile
scripts/generate-multi-ghc-travis-template
scripts/runidris
scripts/runidris-node
src/.ghci
test/*.md
test/*.hs
test/**/*.idr
test/**/*.lidr
test/**/*.ipkg
test/**/*.out
test/**/*.sh
test/**/*.c
test/**/*.h
test/**/*.in
test/ffi004/theOtherType
test/ffi004/theType
test/scripts/timeout
source-repository head
type: git
@ -100,7 +126,7 @@ source-repository head
custom-setup
setup-depends:
Cabal >= 1.10 && < 3.1,
Cabal >= 2.4 && < 3.1,
base >= 4 && <5,
directory,
filepath,
@ -261,14 +287,17 @@ Library
Util.Pretty
, Util.Net
-- Auto Generated
, Paths_idris
, Version_idris
, Tools_idris
, BuildFlags_idris
-- Auto Generated
Autogen-modules: Paths_idris
, Version_idris
, Tools_idris
, BuildFlags_idris
Build-depends: base >=4 && <5
, aeson >= 0.6 && < 1.5
, annotated-wl-pprint >= 0.7 && < 0.8
@ -313,8 +342,8 @@ Library
, async < 2.3
if !impl(ghc >= 8.0)
Build-Depends: semigroups == 0.18.*
, fail == 4.9.0.*
Build-Depends: semigroups == 0.18.*
, fail == 4.9.0.*
Default-Language: Haskell2010
ghc-prof-options: -auto-all -caf-all
@ -333,6 +362,7 @@ Library
cpp-options: -DIDRIS_GMP
if flag(freestanding)
other-modules: Target_idris
autogen-modules: Target_idris
cpp-options: -DFREESTANDING
if flag(CI)
ghc-options: -Werror
@ -381,6 +411,7 @@ Test-suite regression-and-feature-tests
Executable idris-codegen-c
Main-is: Main.hs
autogen-modules: Paths_idris
other-modules: Paths_idris
hs-source-dirs: codegen/idris-codegen-c
@ -396,6 +427,7 @@ Executable idris-codegen-c
Executable idris-codegen-javascript
Main-is: Main.hs
autogen-modules: Paths_idris
other-modules: Paths_idris
hs-source-dirs: codegen/idris-codegen-javascript
@ -411,6 +443,7 @@ Executable idris-codegen-javascript
Executable idris-codegen-node
Main-is: Main.hs
autogen-modules: Paths_idris
other-modules: Paths_idris
hs-source-dirs: codegen/idris-codegen-node
@ -423,3 +456,4 @@ Executable idris-codegen-node
Default-Language: Haskell2010
ghc-prof-options: -auto-all -caf-all
ghc-options: -threaded -rtsopts -funbox-strict-fields

View File

@ -113,18 +113,18 @@ and somewhat self-explanatory.
1. Choose the family your test shall belong to and remember its identifier.
2. Pick the next available integer in the test family. It will be the index.
3. Say the family's identifier is `foo` and the index is `42`. You should call `./mktest.pl foo042` ; this will create the directory and a simple `run` script.
3. Say the family's identifier is `foo` and the index is `42`. You should call `./mktest.pl foo042` ; this will create the directory and a simple `run.sh` script.
4. Modify the `run` script to your liking. If you want to call the idris executable, write `${IDRIS:-idris} $@`.
5. Add any file you may need in the directory. If they don't end in `.idr`, you should remember them for the next step.
6. Add your test in `TestData.hs`. Each family has a list of `(Index, CompatCodegen)`. See the next section for the available values in `CompatCodegen`. In most cases, you should write `( 42, ANY)`.
7. Generate the `expected` file by doing:
7. Generate the `expected.out` file by doing:
```
# Using cabal
cabal test --test-options="--pattern foo042 --accept"
# Using stack
stack test --test-arguments="--pattern foo042 --accept"
```
8. Check the content of `expected`. Maybe the test didn't do what you thought it would. Fix and go back to 7 until it's ok.
8. Check the content of `expected.out`. Maybe the test didn't do what you thought it would. Fix and go back to 7 until it's ok.
### Specifying compatible backends
@ -146,7 +146,7 @@ Currently, `NONE` has the same effect as `ANY`, but this will change.
### Updating golden files
To update the `expected` file for every test, do one of the following:
To update the `expected.out` file for every test, do one of the following:
```
# Using make
@ -157,4 +157,4 @@ cabal test --test-options="--accept"
stack test --test-arguments="--accept"
```
"Accepted" tests are the ones that update the golden file. A test can still fail if the `run` script itself crashes.
"Accepted" tests are the ones that update the golden file. A test can still fail if the `run.sh` script itself crashes.

View File

@ -62,7 +62,7 @@ ingredients = defaultIngredients ++
test :: String -> String -> IO () -> TestTree
test testName path = goldenVsFileDiff testName diff ref output
where
ref = path </> "expected"
ref = path </> "expected.out"
output = path </> "output"
diff ref new | os == "openbsd" = ["diff", "-u", new, ref]
| otherwise = ["diff", "--strip-trailing-cr", "-u", new, ref]
@ -92,7 +92,7 @@ mkGoldenTests testFamilies flags =
-- this thing.
runTest :: String -> Flags -> IO ()
runTest path flags = do
let run = (proc "bash" ("run" : flags)) {cwd = Just path}
let run = (proc "bash" ("run.sh" : flags)) {cwd = Just path}
(_, output, error_out) <- readCreateProcessWithExitCode run ""
writeFile (path </> "output") (normalise output)
when (error_out /= "") $ hPutStrLn stderr ("\nError: " ++ path ++ "\n" ++ error_out)

2
test/base001/run → test/base001/run.sh Executable file → Normal file
View File

@ -3,7 +3,7 @@
set -u
if [[ ${OSTYPE} = 'msys' ]]; then
cat expected # skip this test on Windows
cat expected.out # skip this test on Windows
else
${IDRIS:-idris} "$@" --build base001.ipkg | grep -v 'make.*:'
./base001 2>&1 | grep -v '^sh:.*\./does-not-exist:'

0
test/basic001/run → test/basic001/run.sh Executable file → Normal file
View File

0
test/basic002/run → test/basic002/run.sh Executable file → Normal file
View File

0
test/basic003/run → test/basic003/run.sh Executable file → Normal file
View File

0
test/basic004/run → test/basic004/run.sh Executable file → Normal file
View File

0
test/basic005/run → test/basic005/run.sh Executable file → Normal file
View File

0
test/basic006/run → test/basic006/run.sh Executable file → Normal file
View File

0
test/basic007/run → test/basic007/run.sh Executable file → Normal file
View File

0
test/basic008/run → test/basic008/run.sh Executable file → Normal file
View File

0
test/basic009/run → test/basic009/run.sh Executable file → Normal file
View File

0
test/basic010/run → test/basic010/run.sh Executable file → Normal file
View File

0
test/basic011/run → test/basic011/run.sh Executable file → Normal file
View File

0
test/basic012/run → test/basic012/run.sh Executable file → Normal file
View File

0
test/basic013/run → test/basic013/run.sh Executable file → Normal file
View File

0
test/basic014/run → test/basic014/run.sh Executable file → Normal file
View File

0
test/basic015/run → test/basic015/run.sh Executable file → Normal file
View File

0
test/basic016/run → test/basic016/run.sh Executable file → Normal file
View File

0
test/basic017/run → test/basic017/run.sh Executable file → Normal file
View File

0
test/basic018/run → test/basic018/run.sh Executable file → Normal file
View File

0
test/basic019/run → test/basic019/run.sh Executable file → Normal file
View File

0
test/basic020/run → test/basic020/run.sh Executable file → Normal file
View File

0
test/basic021/run → test/basic021/run.sh Executable file → Normal file
View File

0
test/basic022/run → test/basic022/run.sh Executable file → Normal file
View File

0
test/basic023/run → test/basic023/run.sh Executable file → Normal file
View File

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
${IDRIS:-idris} $@ --quiet --port none < input
${IDRIS:-idris} $@ --quiet --port none < input.in
${IDRIS:-idris} $@ basic024.idr -o basic024
./basic024

4
test/basic025/run → test/basic025/run.sh Executable file → Normal file
View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
${IDRIS:-idris} $@ --quiet --port none < input
${IDRIS:-idris} $@ --quiet --port none < input.in
${IDRIS:-idris} $@ -o basic025 basic025.idr
./basic025 input
./basic025 input.in
rm -f basic025 *.ibc

0
test/bignum001/run → test/bignum001/run.sh Executable file → Normal file
View File

0
test/bignum002/run → test/bignum002/run.sh Executable file → Normal file
View File

0
test/bignum003/run → test/bignum003/run.sh Executable file → Normal file
View File

0
test/bounded001/run → test/bounded001/run.sh Executable file → Normal file
View File

0
test/buffer001/run → test/buffer001/run.sh Executable file → Normal file
View File

0
test/buffer002/run → test/buffer002/run.sh Executable file → Normal file
View File

0
test/contrib001/run → test/contrib001/run.sh Executable file → Normal file
View File

0
test/corecords001/run → test/corecords001/run.sh Executable file → Normal file
View File

0
test/corecords002/run → test/corecords002/run.sh Executable file → Normal file
View File

2
test/delab001/run → test/delab001/run.sh Executable file → Normal file
View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
${IDRIS:-idris} $@ --quiet --port none --nocolor delab001.idr < input
${IDRIS:-idris} $@ --quiet --port none --nocolor delab001.idr < input.in
rm -f *.ibc

0
test/directives001/run → test/directives001/run.sh Executable file → Normal file
View File

0
test/directives003/run → test/directives003/run.sh Executable file → Normal file
View File

0
test/disambig002/run → test/disambig002/run.sh Executable file → Normal file
View File

2
test/docs001/run → test/docs001/run.sh Executable file → Normal file
View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
${IDRIS:-idris} $@ --quiet --port none --nocolor docs001.idr < input
${IDRIS:-idris} $@ --quiet --port none --nocolor docs001.idr < input.in
rm *.ibc

2
test/docs002/run → test/docs002/run.sh Executable file → Normal file
View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
${IDRIS:-idris} $@ --nobanner --nocolor --quiet --port none docs002.idr < input
${IDRIS:-idris} $@ --nobanner --nocolor --quiet --port none docs002.idr < input.in
rm *.ibc

2
test/docs003/run → test/docs003/run.sh Executable file → Normal file
View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
${IDRIS:-idris} $@ --quiet --port none --nocolor docs003.idr < input
${IDRIS:-idris} $@ --quiet --port none --nocolor docs003.idr < input.in
rm *.ibc

Some files were not shown because too many files have changed in this diff Show More