Commit Graph

580 Commits

Author SHA1 Message Date
Timothy Sample 0b49934a0b Remove extra import from 'run-test-suite'.
The '(ice-9 textual-ports)' module is not needed, and using it breaks
the test suite on Guile 2.0.

* tests/run-test-suite.in: Do not use '(ice-9 textual-ports)'.
2019-08-20 11:38:11 -04:00
Timothy Sample 9639f5eff7 Add missing '(gash compat)' import.
This was omitted from ffe9fc1f47.

* gash/shell.scm: Use the '(gash compat)' module.
2019-08-02 20:19:52 -04:00
Timothy Sample fdd835842a Use the 'site' Guile directories when installing.
Thanks to Ludovic Courtès <ludo@gnu.org> for patching this in the Guix
package definition.

* build-aux/guile.am (moddir, ccachedir): Use the 'site' directories.
2019-08-01 09:21:34 -04:00
Timothy Sample d9122d7b68 Use 'sh:exit' for 'errexit'.
* gash/shell.scm (errexit): Exit using 'sh:exit'.
* tests/unit/shell.scm: Make sure exit handlers are called on
'errexit'.
2019-08-01 09:12:35 -04:00
Timothy Sample da9a05d500 Do not use 'with-continuation-barrier'.
It turns out that 'with-continuation-barrier' allows delimited
continuations (i.e., prompts) to get through.

* gash/shell.scm (%subshell): Replace 'with-continuation-barrier' with
'dynamic-wind', making sure to preserve exit statuses that were leaked
through before.
* tests/unit/shell.scm (call-with-temporary-directory): Replace
'with-continuation-barrier' with 'dynamic-wind'.
* tests/spec/oil.scm: Enable previously failing tests.
2019-08-01 09:10:38 -04:00
Timothy Sample 6228064801 Fix top-level 'break', 'continue', and 'return'.
* gash/environment.scm (sh:break, sh:continue, sh:return): Wrap
'abort-to-prompt' with 'false-if-exception'.
* gash/built-ins/break.scm (main): Print warning and continue if
'sh:break' returns.
* gash/built-ins/continue.scm (main): Likewise, but for 'sh:continue'.
* gash/built-ins/return.scm (main): Likewise, but for 'sh:return'.
* tests/functions.org (Top-level return): New test.
* tests/spec/oil.scm: Enable previously failing test.
2019-08-01 09:02:05 -04:00
Timothy Sample 150c6eac53 Handle 'return' errors.
* gash/built-ins/utils.scm (string->exit-status): New procedure.
* gash/built-ins/return.scm (main): Use it to simplify argument
checking; check for too many arguments; and print messages on
errors.
* tests/functions.org (Too many arguments to return): New test.
2019-06-14 20:58:23 -04:00
Timothy Sample ffe9fc1f47 Handle 'break' and 'continue' errors.
* gash/built-ins/utils.scm (string->positive-integer): New function.
* gash/built-ins/break.scm (main): Use it to simplify argument
checking; check for too many arguments; and print messages on errors.
* gash/built-ins/continue.scm (main): Ditto.
* gash/shell.scm (sh:exec-let): Throw an error if a special built-in
fails.
* tests/spec/oil.scm: Enable and adjust previously failing tests.
2019-06-14 20:46:57 -04:00
Timothy Sample 7d2298d15b Aggregate tests into test suites.
This is a big change, but it is conceptually quite simple.  In the old
system, the tests were specified each by multiple files ('.sh', '.exit',
'.stdout', and '.stderr'), and run with the 'test.sh' script.  In the
new system there are multiple tests per file ('.org') and these test
suite files are run with the 'tests/run-test-suite' script.

* tests/00-exit-0.sh,
tests/00-exit-1.exit,
tests/00-exit-1.sh,
tests/00-exit-2.exit,
tests/00-exit-2.sh,
tests/00-exit-error.exit,
tests/00-exit-error.sh,
tests/00-exit-var.exit,
tests/00-exit-var.sh,
tests/00-exit.sh: Delete files, moving their contents...
* tests/exiting.org: ...here.
* tests/01-script-arg-0.sh,
tests/01-script-arg-length.sh,
tests/01-script-arg-length.stdout,
tests/01-script-arg-list.sh,
tests/01-script-arg-list.stdout,
tests/01-script-backslash-space.sh,
tests/01-script-backslash-twice.exit,
tests/01-script-backslash-twice.sh,
tests/01-script-backslash.exit,
tests/01-script-backslash.sh,
tests/01-script-newline.exit,
tests/01-script-newline.sh,
tests/01-script-semi.exit,
tests/01-script-semi.sh,
tests/01-script-shift.sh,
tests/01-script-shift.stdout: Delete files, moving their contents...
* tests/arguments.org: ...here.
* tests/03-echo-brace.sh,
tests/03-echo-brace.stdout,
tests/03-echo-doublequotes.sh,
tests/03-echo-doublequotes.stdout,
tests/03-echo-escaped-doublequotes.sh,
tests/03-echo-escaped-doublequotes.stdout,
tests/03-echo-nesting.sh,
tests/03-echo-nesting.stdout,
tests/03-echo-quoted-doublequotes.sh,
tests/03-echo-quoted-doublequotes.stdout,
tests/03-echo.sh: Delete files, moving their contents...
* tests/words.org: ...here.
* tests/04-echo-equal.sh,
tests/04-echo-equal.stdout,
tests/04-echo-var.sh,
tests/04-echo-word-at-word.sh,
tests/04-echo-word-at-word.stdout,
tests/04-echo-word-at.sh,
tests/04-echo-word-at.stdout: Delete files, moving their contents...
* tests/variable-words.org: ...here.
* tests/05-assignment-backtick.sh,
tests/05-assignment-backtick.stdout,
tests/05-assignment-double-quote.sh,
tests/05-assignment-doublequoted-doublequotes.sh,
tests/05-assignment-doublequoted-doublequotes.stdout,
tests/05-assignment-echo.sh,
tests/05-assignment-echo.stdout,
tests/05-assignment-empty.sh,
tests/05-assignment-empty.stdout,
tests/05-assignment-singlequote.sh,
tests/05-assignment-variable-word.sh,
tests/05-assignment-variable-word.stdout,
tests/05-assignment-word-variable.sh,
tests/05-assignment-word-variable.stdout,
tests/05-assignment.sh: Delete files, moving their contents...
* tests/assignments.org: ...here.
* tests/06-command-compound-word.sh,
tests/06-command-compound-word.stdout,
tests/06-compound-word.sh,
tests/06-compound-word.stdout: Delete files, moving their contents...
* tests/compound-words.org: ...here.
* tests/07-variable-not-or.sh,
tests/07-variable-not-or.stdout,
tests/07-variable-or-doublequote.sh,
tests/07-variable-or-doublequote.stdout,
tests/07-variable-or-empty.sh,
tests/07-variable-or-empty.stdout,
tests/07-variable-or-slash.sh,
tests/07-variable-or-variable.sh,
tests/07-variable-or-variable.stdout,
tests/07-variable-or.sh,
tests/07-variable-or.stdout: Delete files, moving their contents...
* tests/variable-or.org: ...here.
* tests/08-variable-and.sh,
tests/08-variable-and.stdout,
tests/08-variable-not-and.sh,
tests/08-variable-not-and.stdout: Delete files, moving their contents...
* tests/variable-and.org: ...here.
* tests/10-else-multiple.sh,
tests/10-else.multiple.stdout,
tests/10-if-bracket-false.sh,
tests/10-if-bracket.sh,
tests/10-if-elif.sh,
tests/10-if-else.sh,
tests/10-if-false.sh,
tests/10-if-line.sh,
tests/10-if-multiple.sh,
tests/10-if-multiple.stdout,
tests/10-if-redirect.sh,
tests/10-if-test-false.sh,
tests/10-if-test.sh,
tests/10-if-word-variable.sh,
tests/10-if.sh: Delete files, moving their contents...
* tests/conditionals.org: ...here.
* tests/11-for-done-subshell.sh,
tests/11-for-done-subshell.stdout,
tests/11-for-split-sequence.sh,
tests/11-for-split-sequence.stdout,
tests/11-for.sh,
tests/11-for.stdout: Delete files, moving their contents...
* tests/loops.org: ...here.
* tests/20-and.exit,
tests/20-and.sh,
tests/20-exec.sh,
tests/20-or.sh,
tests/20-pipe-exit-0.sh,
tests/20-pipe-exit-1.exit,
tests/20-pipe-exit-1.sh,
tests/20-pipe-sed-cat.sh,
tests/20-pipe-sed-cat.stdout,
tests/20-pipe-sed.sh,
tests/20-pipe-sed.stdout,
tests/20-semi.exit,
tests/20-semi.sh: Delete files, moving their contents...
* tests/pipes-and-booleans.org: ...here.
* tests/30-for-substitution.sh,
tests/30-for-substitution.stdout,
tests/30-substitution-assignment-at.sh,
tests/30-substitution-assignment-at.stdout,
tests/30-substitution-assignment.sh,
tests/30-substitution-assignment.stdout,
tests/30-substitution-backtick.sh,
tests/30-substitution-backtick.stdout,
tests/30-substitution-redirect.sh,
tests/30-substitution-redirect.stdout,
tests/30-substitution-word.sh,
tests/30-substitution-word.stdout,
tests/30-substitution.sh,
tests/30-substitution.stdout: Delete files, moving their contents...
* tests/command-substitution.org: ...here.
* tests/40-assignment-eval-echo.sh,
tests/40-assignment-eval-echo.stdout,
tests/40-eval-echo-variable.sh,
tests/40-eval-echo-variable.stdout,
tests/40-eval.sh,
tests/40-eval.stdout: Delete files, moving their contents...
* tests/eval.org: ...here.
* tests/41-dot.sh,
tests/41-dot.stdout: Delete files, moving their contents...
* tests/dot.org: ...here.
* tests/42-export-new.sh,
tests/42-export-new.stdout,
tests/42-sh-export-new.sh,
tests/42-sh-export-new.stdout,
tests/42-sh-export.sh,
tests/42-sh-export.stdout,
tests/42-sh.sh,
tests/42-sh.stdout: Delete files, moving their contents...
* tests/exporting.org: ...here.
* tests/data/42-export-new.sh: New file (copied from
'tests/42-export-new.sh').
* tests/43-trap-subshell.sh,
tests/43-trap-subshell.stdout: Delete files, moving their contents...
* tests/signals.org: ...here.
* tests/50-iohere-builtin.sh,
tests/50-iohere.sh,
tests/50-iohere.stdout,
tests/50-redirect-append.sh,
tests/50-redirect-append.stdout,
tests/50-redirect-clobber.sh,
tests/50-redirect-clobber.stdout,
tests/50-redirect-in-out.sh,
tests/50-redirect-in-out.stdout,
tests/50-redirect-in.sh,
tests/50-redirect-merge.sh,
tests/50-redirect-merge.stdout,
tests/50-redirect-pipe.sh,
tests/50-redirect-pipe.stdout,
tests/50-redirect-sed.sh,
tests/50-redirect-sed.stdout,
tests/50-redirect-space.sh,
tests/50-redirect-space.stdout,
tests/50-redirect.sh,
tests/50-redirect.stdout: Delete files, moving their contents...
* tests/redirects.org: ...here.
* tests/60-function-at.sh,
tests/60-function-at.stdout,
tests/60-function.sh,
tests/60-function.stdout,
tests/60-subst.sh: Delete files, moving their contents...
* tests/functions.org: ...here.
* tests/70-hash-hash.sh,
tests/70-hash-hash.stdout,
tests/70-hash.sh,
tests/70-hash.stdout,
tests/70-percent-percent.sh,
tests/70-percent-percent.stdout,
tests/70-percent-space.sh,
tests/70-percent-space.stdout,
tests/70-percent.sh,
tests/70-percent.stdout,
tests/70-slash-string-slash.sh,
tests/70-slash-string.sh,
tests/70-slash-string.stdout,
tests/70-slash.sh,
tests/70-slash.stdout: Delete files, moving their contents...
* tests/variable-patterns.org: ...here.
* tests/100-bracket-file.sh,
tests/100-cd-foo.exit,
tests/100-cd-foo.sh,
tests/100-cd.sh,
tests/100-cd.stdout,
tests/100-test-false.sh,
tests/100-test-file.sh,
tests/100-test.sh: Delete files.
* tests/README: Move this...
* tests/data/README: ...here and adapt to the new directory.
* test.sh: Delete file.
* tests/run-test-suite.in: New file.
* configure.ac: Configure it.
* Makefile.am (TEST_EXTENSIONS): Replace '.sh' with '.org'.
(SH_LOG_COMPILER): Delete variable.
(ORG_LOG_COMPILER): New variable.
(FULL_TESTS, XFAIL_TESTS): Replace '.sh' tests with '.org' tests.
(BROKEN_TESTS): Delete variable.
(TEST_DATA_FILES): Remove '.exit' and '.stdout' files; add
tests/data/42-export-new.sh.
(EXTRA_DIST): Add tests/data/README; remove tests/README,
BROKEN_TESTS, and test.sh.
* .gitignore: Adjust accordingly.
2019-06-14 20:27:33 -04:00
Timothy Sample 375752301c Update the specification tests.
* tests/spec/oil.scm: Update to the latest commit and filter out some
new failing tests.
2019-06-07 10:01:42 -04:00
Timothy Sample 945c54f8b2 Fix a typo in NEWS.
* NEWS: Fix a typo.
2019-06-03 21:56:52 -04:00
Timothy Sample a84eb9eb02 Update NEWS.
* NEWS: Add a date for the 0.1 release.
2019-06-01 12:38:59 -04:00
Timothy Sample da54a7ac9f Test Guile 2.0 and 2.2 during CI.
* build-aux/gitlab-ci.yml (before-script): Use a variable for the
Guile package version.
(test): Rename this...
(test-guile-2.2): ...to this and set the Guile version variable.
(test-guile-2.0): New job.
2019-06-01 11:32:34 -04:00
Timothy Sample d465be7275 Install texinfo for CI script.
* build-aux/gitlab-ci.yml (before-script): Install texinfo.
2019-06-01 11:12:44 -04:00
Timothy Sample cf118f7a39 Fix 'setvbuf' wrapper for Guile 2.0.
* gash/compat.scm: Add '(ice-9 match)' to the list of used modules.
2019-06-01 11:09:29 -04:00
Timothy Sample 0306060fca Update URLs for Savannah.
* configure.ac: Update bug report address.
* guix.scm: Update homepage.
2019-06-01 11:09:29 -04:00
Timothy Sample 453d48d850 Add a THANKS file.
* THANKS: New file.
* Makefile.am: Distribute it.
2019-06-01 11:09:29 -04:00
Timothy Sample 3a4433371f Fill out the manual.
* doc/gash.texi: Add an introduction, add a discussion of included and
missing features, document the parser interface, and remove the
indexes.
* doc/syntax.txt: Update to match the manual.
2019-06-01 11:09:07 -04:00
Timothy Sample 8e11fe417b Clarify the license of COPYING.CC0.
* COPYING.CC0: Add a license notice.
2019-05-28 14:55:22 -04:00
Timothy Sample 27df6180c3 Remove extra '<sh-begin>' wrappers.
This commit fixes many differences between the parser output and the
syntax document.

* gash/parser.scm (make-parser): Only wrap a command list with
'<sh-begin>' when necessary.
* tests/unit/parser.scm: Update tests accordingly.
2019-05-26 20:37:53 -04:00
Timothy Sample 490878443b Further clarify test copyrights.
* tests/COPYRIGHT: Rename this...
* tests/README: ...to this and make it much more explicit.
* Makefile.am (EXTRA_DIST): Update name.
2019-05-24 14:15:22 -04:00
Timothy Sample fe42975cc2 Distribute a ChangeLog stub for the first release.
* Makefile.am (gen-ChangeLog): Do not generate the ChangeLog from Git.
2019-05-24 13:00:17 -04:00
Timothy Sample 925903c477 Add missing copyright notice in coverage script.
* tools/coverage.in: Add missing copyright notice.
2019-05-22 01:03:43 -04:00
Timothy Sample 2fe190e497 Clarify the copyrights of the integration tests.
* tests/COPYRIGHT: New file.
* Makefile.am (EXTRA_DIST): Add it.
2019-05-22 00:44:39 -04:00
Timothy Sample 597a6bcfb1 Touch up metadata and copyright notices.
* build-aux/gitlab-ci.yml,
build-aux/pre-inst-env.in,
configure.ac,
test.sh,
tests/spec/Makefile.am,
tests/spec/check-spec: Add copyright notices and GPLv3+ license notice.
* guix.scm: Add a "special exception" permissive license notice.
* doc/syntax.txt: Add title, introduction, copyright notice, and a
simple all-permissive license.
* COPYING.CC0: New file.
* NEWS: Reformat and add CC0 license notice.
* README: Add CC0 license notice.
* Makefile.am: Add copyright notices and GPLv3+ license notice.
(EXTRA_DIST): Add COPYING.CC0.
2019-05-22 00:44:39 -04:00
Timothy Sample eaf8b5da61 Make sure that the tarball has everything.
* Makefile.am (distcheck-hook): New target.
2019-05-22 00:44:39 -04:00
Timothy Sample a4efd9359e Use Automake recipes from Guile.
* build-aux/guile-rules.am: Delete file.
* build-aux/guile.am: New file.
* .gitignore: Do not ignore it.
* Makefile.am: Adapt variable names to the new file.
2019-05-22 00:44:39 -04:00
Timothy Sample 2162c40492 Add missing quotes in the test script.
* test.sh: Add missing quotes.
2019-05-22 00:44:39 -04:00
Timothy Sample ad73b36116 Fix 'make distclean'.
* Makefile.am (distclean-local): Run 'make distclean' for the
specification tests.
2019-05-22 00:44:33 -04:00
Timothy Sample 95545c9269 Fix building from an external directory.
* Makefile.am (scripts/gash): Make sure the 'scripts' directory exists
in the build tree.
(SH_LOG_COMPILER): Call 'test.sh' from the source tree.
* test.sh: Change the default test shell from 'scripts/gash' to
'gash'; export a 'TEST_TMP' variable that tells tests where to store
temporary files; and make sure all output is written to the build
directory.
tests/50-redirect-append.sh: Use the 'TEST_TMP' variable.
tests/60-subst.sh: Ditto.
2019-05-20 18:07:47 -04:00
Timothy Sample d257dac0c6 Rewrite README.
* README: Rewrite with more information.
2019-05-20 18:07:47 -04:00
Timothy Sample 38c832a8e2 Add missing copyright headers.
* gash/pattern.scm,
gash/shell.scm,
tests/bootstrap/bash-without-bash.scm,
tests/spec/oil.scm,
tests/unit/config.scm.in: Add missing copyright header.
2019-05-20 18:07:47 -04:00
Timothy Sample 8998143286 Add missing '!' to 'pre-inst-env' shebang.
* build-aux/pre-inst-env.in: Add missing '!' to shebang.
2019-05-20 18:07:47 -04:00
Timothy Sample 3d80f05940 Fix readline-related compiler warnings.
* gash/gash.scm: Use the readline module at expansion time too, so
that the compiler can see it.
2019-05-20 18:07:47 -04:00
Timothy Sample e86623b642 Clean up version text.
* gash/gash.scm (display-version): Clean up output.
2019-05-20 18:07:47 -04:00
Timothy Sample 669c414116 Prefer 'if-guile-version-below' to 'cond-expand'.
* gash/compat.scm: Use 'if-guile-version-below' over 'cond-expand'.
* gash/compat/textual-ports.scm: Ditto.
2019-05-20 18:07:47 -04:00
Timothy Sample 2d46b8b43e Move 'setvbuf' shim to '(gash compat)'.
* tests/unit/shell.scm: Mode 'setvbuf' shim...
* gash/compat.scm: ...here.
2019-05-20 18:07:47 -04:00
Timothy Sample 2d19d82444 Make the bootstrap test more realistic.
Instead of building regular Bash using regular Gash, we now build
minimal Bash using the bootstrap build inputs, with bootstrap Bash
replaced by bootstrap Gash.

* tests/bootstrap/bash-without-bash.scm (gash-with-links): Rename this...
(%bootstrap-gash): ...to this, and use nothing but the bootstrap Guile
to build and run it.
(%bootstrap-coreutils&co-without-bash): New variable.
(%bootstrap-coreutils&co?): New function.
(%boot0-inputs): New variable.
2019-05-20 18:07:47 -04:00
Timothy Sample 0c57fc9ef9 Move 'textual-ports' under 'compat'.
* gash/textual-ports.scm: Move this...
* gash/compat/textual-ports.scm: ...here.
* Makefile.am, gash/lexer.scm, gash/parser.scm, gash/shell.scm,
tests/unit/shell.scm: Update references.
2019-05-20 18:07:47 -04:00
Timothy Sample 878b9c3dca Add support for Guile 2.0.9.
* gash/compat.scm: New file.
* gash/compat/hash-table.scm: New file.
* Makefile.am: Add them.
* .dir-locals.scm: Add indentation for 'if-guile-version-below'.
* guix.scm (guile-2.0.9): New variable.
* gash/built-ins/echo.scm (escape->control): Use '#\esc'.
* gash/environment.scm: Use '(gash compat hash-table)'.
* gash/built-ins/break.scm,
gash/built-ins/cd.scm,
gash/built-ins/command.scm,
gash/built-ins/continue.scm,
gash/built-ins/dot.scm,
gash/built-ins/exec.scm,
gash/built-ins/exit.scm,
gash/built-ins/pwd.scm,
gash/built-ins/return.scm,
gash/built-ins/set.scm,
gash/built-ins/shift.scm,
gash/built-ins/trap.scm,
gash/built-ins/type.scm,
gash/built-ins/umask.scm,
gash/eval.scm,
tests/unit/automake.scm: Use '(gash compat)'.

squash! Add support for Guile 2.0.9.
2019-05-20 18:07:47 -04:00
Timothy Sample 3f745ae39e Turn off auto-compile while compiling.
This prevents Guile from complaining when compiling the project from
within the Guix build environment.

* build-aux/guile-rules.am: Set 'GUILE_AUTO_COMPILE' to '0' when
compiling.
2019-05-20 18:07:47 -04:00
Timothy Sample 7e65eae774 Remove extra shells from the spec tests.
* tests/spec/oil.scm: Patch out all reference shells from the test
suite expect for Bash.
2019-05-20 18:07:47 -04:00
Timothy Sample c61b1d6fef Make the Guix package work without Git.
This commit generates a '.tarball-manifest' file that gets placed in
the distribution tarball and simply lists all the files that are in
the Git tree.  It is used to determine which files should be
considered source files when building the package using Guix.

* guix.scm (make-select): Fall back on reading from
'.tarball-manifest' if a Git repository is not available.
2019-05-20 18:07:47 -04:00
Timothy Sample 511dae3577 Add missing files to the distribution tarball.
* Makefile.am (EXTRA_DIST): Add various scripts, metadata, helpful
files, and tests.
2019-05-20 18:07:47 -04:00
Timothy Sample fcf32d1cad Setup documentation generation.
* Makefile.am (info_TEXINFOS, gash_TEXINFOS): New targets.
* guix.scm: Add 'texinfo' to build inputs.
* doc/gash.info: Delete file.
* .gitignore: Ignore generated documentation files.
2019-05-20 18:07:47 -04:00
Timothy Sample 6283a632ba Fix test data filename.
* tests/for-done-subshell.stdout: Rename this...
* tests/11-for-done-subshell.stdout: ...to this.
2019-05-20 18:07:47 -04:00
Timothy Sample 2e51c3f9ab Add missing tests to the Makefile.
* Makefile.am (FULL_TESTS): Add tests/05-assignment-backtick.sh,
tests/10-if-line.sh, tests/10-if-redirect.sh, and
tests/20-pipe-sed-cat.sh.
2019-05-20 18:07:47 -04:00
Timothy Sample 6383159503 Remove the bootstrap phase from the Guix package.
This phase has been part of the upstream build system for a while now.

* guix.scm: Remove bootstrap phase.
2019-05-20 18:07:47 -04:00
Timothy Sample 536319194f Delete unused test data.
* tests/data/basename.sed,
tests/data/fooRbar,
tests/data/ro.tar: Delete files.
2019-05-20 18:07:47 -04:00
Timothy Sample ea7266e8f1 Add missing '.PHONY' indicator to Makefile.
* Makefile.am (test-list): Mark as phony.
2019-05-20 18:07:32 -04:00