Commit Graph

30 Commits

Author SHA1 Message Date
Qi Xiao
39a93d4788 Bump Version and DeprecationLevel. 2021-08-21 16:32:24 +01:00
Qi Xiao
1cc3faa15a Make use of (*testing.T).Cleanup in more places. 2021-08-06 23:49:11 +01:00
Qi Xiao
e9d328aa16 Make use of (*testing.T).Cleanup for test cleanups.
This allows turning the following pattern in tests:

  value, cleanup := setupSomething()
  defer cleanup()

into the following:

  value := setupSomething(t)
2021-08-06 23:21:23 +01:00
Qi Xiao
adf8066819 pkg/testutil: Make MustWriteFile easier to use.
The function now take a string for the file content, and always uses 0600 for
file permission.
2021-08-06 21:38:37 +01:00
Qi Xiao
cc61a9505a pkg/prog/progtest: Implement MustWriteFile in terms of testutil.MustWriteFile. 2021-08-06 21:31:05 +01:00
Qi Xiao
e035930e49 Merge branch 'master' into xdg-dir 2021-08-05 22:36:53 +01:00
Qi Xiao
ac3b7342c9 pkg/prog/progtest: Add TestExit for testing exit code. 2021-08-05 22:22:44 +01:00
Qi Xiao
c3083d0544 pkg/prog: Add a -rc flag.
This is added for easier integration testing, but can also be useful to actually use.
2021-08-05 22:17:08 +01:00
Qi Xiao
ebf02e3a91 Fix build on Go 1.15. 2021-07-09 01:30:26 +01:00
Qi Xiao
be84cb0a86 Explicitly handle -h as an unsupported flag. 2021-07-09 01:16:19 +01:00
Qi Xiao
480bca8f34 Add a missing cleanup in progtest_test.go.
The missing cleanup is leaving some directories unremoved in the system temporary directory.
2021-06-27 23:35:43 +01:00
Qi Xiao
42867d56ba Remove the -bin flag.
Always determine it with os.Executable() instead.
2021-06-27 23:12:09 +01:00
Qi Xiao
7364eff3da Mark internal flags as such in their usage messages. 2021-06-27 22:58:12 +01:00
Kurtis Rader
df3e7a9268 Add a -i CLI option
POSIX shells have a `-i` short option to force interactive mode. Some
programs, such as the `script` command, assume that option is recognized
by the shell it spawns. There isn't any reason elvish shouldn't silently
ignore that option.

Resolves #1292
2021-04-20 16:15:22 -04:00
Qi Xiao
585509007e Update for 0.15.0 release.
* Rebrand NEXT-RELEASE.md to the release notes for 0.15.0, and publish it.

* Bump default deprecation level to 15.

* Add download links in website/get/prelude.md.
2021-01-30 11:26:39 +00:00
Qi Xiao
196eea21d4 Change module import path to src.elv.sh 2021-01-27 01:30:25 +00:00
Qi Xiao
47d9766f5c Control deprecation warnings with a number instead of a bool.
Previously, to avoid showing deprecation warnings for the next release when the
user is running on HEAD, a boolean CLI flag -show-deprecations is introduced,
and is set to false in the master branch. The idea is that release branches will
have this default to true, so people running released versions will see
deprecations.

However, this means that people running on HEAD will never see any deprecations
unless they use this CLI flag, which is not ideal. This commit replaces the flag
bool -show-deprecations with a numerical -deprecation-level flag, which requests
deprecations that are active as of release 0.X to be shown. The default value of
this flag will be the minor version number of the *last* release, so that people
running HEAD will see as many deprecation warnings as people running the last
release would. This number will be bumped just before releases.
2021-01-19 21:37:36 +00:00
Kurtis Rader
d241243fdf Ensure the daemon doesn't have fds open on the tty
The Elvish daemon should not inherit file descriptors open on the tty.
Make the daemon's stdin open on the null device and its stdout/stderr
open on a predictable file.

Fixes #1191
2021-01-16 23:18:38 +00:00
Kurtis Rader
9c7c9cf7d9 [cleanup] trivial golint suggested changes
As with commit #eb2a792 I acknowledge that `golint` recommendations are
controversial and should not automatically be acted on. Nonetheless,
this change fixes legitimate lint issues such as copy/paste cleanups,
style problems I introduced (`i += 1` versus `i++`) or method/var comments
that are not in the preferred form.
2020-12-25 01:11:33 +00:00
Qi Xiao
11898f763a pkg/util: Break into fsutil/ and logutil/. 2020-09-03 05:27:18 +01:00
Qi Xiao
48919bcb24 pkg/: Move test utilities from util/ to testutil/. 2020-09-03 04:55:16 +01:00
Kurtis Rader
fbd86925a9 Prevent I/O deadlocks during shell testing
If the shell outputs more data than can be buffered the test will
deadlock. I noticed this when working on issue #661. The tests I was
writing would deadlock because a tty can buffer significantly less data
than a pipe. Even using a pipe, which typically buffers 8 to 128 KiB, this
is theoretically a problem. So use a goroutine to capture the output as it
is generated rather than reading it all at once when the test terminates.
2020-08-11 15:58:20 +01:00
Kurtis Rader
3643f252f3 Verify stdout and stderr in shell tests
While working on my next commit, to prevent I/O deadlocks, I experienced
some problems because I had a syntax error in the Elvish code to generate
the output. That wasn't immediately obvious because I had copied another
test that only tested the stdout of the shell and the syntax error was
written to stderr. This change modifies existing tests to verify both
stdout and stderr have the expected content.

Note that there are three interactive tests for which we still do not
verify the content of stderr. That's because stderr for those tests only
contains a shell prompt whose content changes each time the test is run.
TBD is modifying the interactive tests to have a predictable prompt.
2020-08-11 15:58:20 +01:00
Qi Xiao
663b10d8e2 Suppress deprecations by default.
The behavior is controlled by a global flag that will be flipped for the release
branch. A flag is available to force deprecations to be shown or hidden.
2020-04-26 21:26:53 +01:00
Qi Xiao
905447eda5 pkg/prog: Improve error handling of CPU profile, and add tests.
This addresses #944.
2020-04-25 01:04:55 +01:00
Qi Xiao
e6c5ebfc23 pkg/prog: Add tests.
This addresses #944.
2020-04-25 00:57:35 +01:00
Qi Xiao
78cae6a695 pkg/prog/{shell,web} -> pkg/{shell,web}. 2020-04-25 00:12:18 +01:00
Qi Xiao
928949077b pkg/prog: Move all Program implementations into own packages.
This fixes #985.
2020-04-25 00:12:18 +01:00
Qi Xiao
5b88057c94 pkg/prog: Remove Main; expose Run.
This is to prepare moving all the Program implementations into their respective
packages.

This addresses #985.
2020-04-25 00:12:18 +01:00
Qi Xiao
be471ec761 pkg/program -> pkg/prog. 2020-04-25 00:12:18 +01:00