-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTest
executable file
·86 lines (75 loc) · 4 KB
/
Test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env bash
set -Eeuo pipefail
trap 'ec=$?; echo 1>&2 "ERROR: ec=$ec line=$LINENO cmd=$BASH_COMMAND";
exit $ec;' ERR
# The t8dev program relies on T8_PROJDIR being set to point to the root
# directory of the project using t8dev. (This is because it downloads and
# builds things to the .build/ directory in that project dir.) You will
# also want to ensure that your .gitignore file ignores the .build/
# directory under $T8_PROJDIR.
#
# This code sets T8_PROJDIR to the directory in which this Test script
# resides.
#
export T8_PROJDIR=$(cd "$(dirname "$0")" && pwd -P)
# Typical projects would simply run `source ./pactivate` here to install
# (if necessary) and activate the virtual environment. Since we use this
# project to test external- and non-virtualenv installs, we don't do
# that, instead insisting that the virtualenv be activated before this
# script is run.
t8dev -h >/dev/null || {
cat <<_____
───────────────────────────────────────────────────────────────────────────
I cannot find the 't8dev' command. You need to do one of the following:
1. Activate your external Python virtual environment containing 't8dev'; or
2. Install t8dev into the current environment with 'pip install t8dev'; or
3. Execute 'source ./pactivate' to activate a project-local virtualenv.
See README.md for more details.
───────────────────────────────────────────────────────────────────────────
_____
exit 1
}
# Unlike projects that have their own local virtualenv, we do not need
# the t8setup.bash script, since that exists mainly to set up the
# project-local virtualenv. (It also deals with fetching the Git
# submodules for t8dev and r8format source, if necessary.)
# Install the minimal toolset to assemble an example program.
#
# If you want to use these tools directly from the command line you'll
# need to add $T8_PROJDIR/.build/tool/bin/ to your $PATH. But the `t8dev`
# program will find them without you doing this.
#
t8dev toolset asl
# Build source code provided by the t8dev `testmc` package. The output
# is placed under .buld/obj/testmc/.
t8dev asl t8dev
# Build source code modules for unit testing in this repo, by convention
# stored under src/. This will find all src/**/*.pt files that include a
# `test_rig` or `object_files` declaration and build the source under
# test into a matching .build/ptobj/ subdirectory. (That directory
# contains the .p ASL output file and also the listing, which can be
# useful for debugging.)
t8dev asl auto src/
pytest
# By convention exe/ is where we keep complete programs that use the
# modules under src/. This assembles those to .build/obj/exe/.
# If you have subdirs or non-assembly files here, you will want to
# use a more sophisticated shell glob or `find` command.
t8dev asl asm exe/*
# The tools installed by `t8dev toolset` commands are placed under
# $T8_PROJDIR/.build/tool/bin/. Because this is not known to the Python
# virtual environment, and we're not calling them through t8dev, we
# need to add these to the path ourselves.
PATH="$T8_PROJDIR/.build/tool/bin:$PATH"
# This assumes that `cpmhello.p` has been assembled with the correct
# start address of $100, creating a binary file with all the assembled
# code from its start address.
exebuild="$T8_PROJDIR/.build/obj/exe"
p2bin -q "$exebuild"/cpmhello.p "$exebuild"/cpmhello.com
# Now we install the RunCPM emulator and use it to run cpmhello.com.
# The `--autorun` flag to `t8dev emulator runcpm` makes it, on boot,
# immediately run the .COM file given as the argument. (Otherwise
# it will simply be loaded into the emulator and you will be left
# in interactive mode.)
t8dev toolset RunCPM
t8dev emulator runcpm --autorun $exebuild/cpmhello.com