Skip to content

Commit

Permalink
Add Windows Caveats to README, add bash.exe check at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
timwoj committed Jan 13, 2023
1 parent f256b5a commit ff90899
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
19 changes: 17 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ BTest has the following prerequisites:
- Python version >= 3.7 (older versions may work, but are not
well-tested).

- Bash (note that on FreeBSD and Alpine Linux, bash is not installed
by default).
- Bash. Note that on FreeBSD and Alpine Linux, bash is not installed by
default. This is also required on Windows, in the form of Git's msys2, Cygwin,
etc.

BTest has the following optional prerequisites to enable additional
functionality:
Expand All @@ -41,6 +42,20 @@ functionality:
- perf (Linux only). Note that on Debian/Ubuntu, you also need to install
the "linux-tools" package.

Windows Caveats
---------------

When running BTest on Windows, you must have a bash shell installed of some
sort. This can be from WSL, Cygwin, msys2, Git, or any number of other methods,
but ``bash.exe`` must be available. BTest will check for its existence at
startup and exit if it is not available.

A minor change must be made to any configuration value that is a path list. For
example, if you are setting the ``PATH`` environment variable from your
btest.cfg. In these cases, you should use ``$(pathsep)s`` in the configuration
instead of bare ``:`` or ``;`` values to separate the paths. This ensures that
both POSIX and Windows systems handle the path lists correctly.

Download and Installation
=========================

Expand Down
15 changes: 15 additions & 0 deletions btest
Original file line number Diff line number Diff line change
Expand Up @@ -2788,7 +2788,22 @@ if __name__ == '__main__':
pyver_min = sys.version_info[1]

if sys.platform == 'win32':
# The "fork" method doesn't exist at all on Windows, so force over to
# "spawn" instead.
mp.set_start_method('spawn')

# Double-check that `bash.exe` exists and is executable, since it's
# required for pretty much anything here to work on Windows. Note we're
# doing this prior to parsing the config file because it's required for
# backtick-expansion there as well.
try:
subprocess.call(['bash.exe', '--version'],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
except FileNotFoundError:
print("error: bash.exe is required to be in your PATH to run BTest.", file=sys.stderr)
sys.exit(1)

elif (pyver_maj == 3 and pyver_min >= 8) or pyver_maj > 3:
mp.set_start_method('fork')

Expand Down

0 comments on commit ff90899

Please sign in to comment.