mirror of
https://github.com/open-simh/simh.git
synced 2026-01-28 04:58:26 +00:00
CMake: Make generate.py reusable
Make generate.py resuable outside of open-simh, as suggested and
motivated by Richard Cornwell's simulator repository.
- Make the "experimental" rule optional. Do not generate a Python
"KeyError" if the rule is missing.
- Add documentation on how to use the CMake infrastructure outside
of open-simh: Customize the packaging.py script, season to taste.
- Update the KA10 simulator customization, moving it to its own
Python script, simgen/pdp10_simulator.py. Preparatory move that
anticipates additional frontpanel and display options.
- generate.py option "--skip-orphans": Skip the orphaned simulator
check (i.e., don't cross-reference the simulators in packaging.py
with what was scraped from the makefile.)
- Add "TEST_ARGS" argument to CMake's add_simulator function so that the
IBM 1130 simulator can pass to "-g" on the command line to disable the
GUI when running RegisterSanityCheck, i.e.:
ibm1130 RegisterSanityCheck -g
This fixes an edge case Heisenbug encountered during Github CI/CD
tests where ibm1130 appears to hang indefinitely on the Windows
runners.
The cause is the GUI's Pump() thread function being prematurely
terminated before all GUI resources are acquired. The net result is an
infinite loop in the MS C runtime trying to exit the process with
unstable internal state. (Separate patch: synchronization across main
and Pump() threads to ensure resource acquisition completes.)
This issue never shows up on non-Windows platforms or the SIMH makefile.
- cmake/generator.py, cmake/simgen: Add a "test_args" keyword argument
to the BasicSimulator constructor that holds the tests argument
parameter emitted as the "TEST_ARGS" argument to a simulator's
add_simulator(). Ensure that the IBM 1130 emits 'TEST_ARG "-g"' in its
add_simulator().
- scp.c: reset_all_p() adds 'P' to the existing switches, versus saving
sim_switches and ONLY setting the 'P' power-up reset switch. Net effect
is that the IBM 1130 simulator actually sees the 'G' flag that inhibits
the GUI during the console device reset.
This commit is contained in:
committed by
Paul Koning
parent
24f145ad16
commit
191b2131e9
@@ -32,9 +32,9 @@ def process_makefile(makefile_dir, debug=0):
|
||||
if debug >= 4:
|
||||
pprint.pp(defs)
|
||||
|
||||
all_rule = rules.get('all')
|
||||
all_rule = rules.get('all') or rules.get('ALL')
|
||||
if all_rule is None:
|
||||
print('{0}: "all" rule not found. Cannot process.'.format(GEN_SCRIPT_NAME))
|
||||
print('{0}: "all" rule not found. Cannot proceed.'.format(GEN_SCRIPT_NAME))
|
||||
|
||||
simulators = SCC.CMakeBuildSystem()
|
||||
for all_targ in SPM.shallow_expand_vars(all_rule, defs).split():
|
||||
@@ -42,9 +42,10 @@ def process_makefile(makefile_dir, debug=0):
|
||||
walk_target_deps(all_targ, defs, rules, actions, simulators, debug=debug)
|
||||
|
||||
experimental_rule = rules.get('experimental')
|
||||
for experimental_targ in SPM.shallow_expand_vars(experimental_rule, defs).split():
|
||||
print("{0}: exp target {1}".format(GEN_SCRIPT_NAME, experimental_targ))
|
||||
walk_target_deps(experimental_targ, defs, rules, actions, simulators, debug=debug)
|
||||
if experimental_rule is not None:
|
||||
for experimental_targ in SPM.shallow_expand_vars(experimental_rule, defs).split():
|
||||
print("{0}: exp target {1}".format(GEN_SCRIPT_NAME, experimental_targ))
|
||||
walk_target_deps(experimental_targ, defs, rules, actions, simulators, debug=debug)
|
||||
|
||||
simulators.collect_vars(defs, debug=debug)
|
||||
return simulators
|
||||
@@ -70,6 +71,8 @@ def walk_target_deps(target, defs, rules, actions, simulators, depth='', debug=0
|
||||
print('{0}-- target: {1}'.format(depth, target))
|
||||
|
||||
target_deps = SPM.target_dep_list(target, rules, defs)
|
||||
if debug >= 2:
|
||||
print('{0}target deps: {1}'.format(depth, target_deps))
|
||||
|
||||
has_buildrom = any(filter(lambda dep: dep == '${BUILD_ROMS}', target_deps))
|
||||
if debug >= 1:
|
||||
@@ -131,15 +134,14 @@ if __name__ == '__main__':
|
||||
help='Debug level (0-3, 0 == off)')
|
||||
args.add_argument('--srcdir', default=None,
|
||||
help='makefile source directory.')
|
||||
## args.add_argument('--file', '-f', default=os.path.join(GEN_SCRIPT_DIR, 'simh_makefile.cmake'),
|
||||
## help='Output file for "all-in-one" CMakeLists.txt, default is simh_makefile.cmake')
|
||||
args.add_argument('--skip-orphans', action='store_true',
|
||||
help='Skip the check for packaging orphans')
|
||||
|
||||
flags = vars(args.parse_args())
|
||||
|
||||
debug_level = flags.get('debug')
|
||||
makefile_dir = flags.get('srcdir')
|
||||
|
||||
print('{0}: Expecting to emit {1} simulators.'.format(GEN_SCRIPT_NAME, len(SPKG.package_info.keys())))
|
||||
|
||||
found_makefile = True
|
||||
if makefile_dir is None:
|
||||
## Find the makefile, which should be one directory up from this Python
|
||||
@@ -171,15 +173,22 @@ if __name__ == '__main__':
|
||||
## Sanity check: Make sure that all of the simulators in SPKG.package_info have
|
||||
## been encountered
|
||||
for simdir in sims.dirs.keys():
|
||||
if debug_level >= 2:
|
||||
print('{}: simdir {}'.format(GEN_SCRIPT_NAME, simdir))
|
||||
for sim in sims.dirs[simdir].simulators.keys():
|
||||
SPKG.package_info[sim].encountered()
|
||||
|
||||
orphans = [ sim for sim, pkg_info in SPKG.package_info.items() if not pkg_info.was_processed() ]
|
||||
if len(orphans) > 0:
|
||||
print('{0}: Simulators not extracted from makefile:'.format(GEN_SCRIPT_NAME))
|
||||
for orphan in orphans:
|
||||
print('{0}{1}'.format(' ' * 4, orphan))
|
||||
sys.exit(1)
|
||||
if not flags.get('skip_orphans'):
|
||||
print('{0}: Expecting to emit {1} simulators.'.format(GEN_SCRIPT_NAME, len(SPKG.package_info.keys())))
|
||||
|
||||
orphans = [ sim for sim, pkg_info in SPKG.package_info.items() if not pkg_info.was_processed() ]
|
||||
if len(orphans) > 0:
|
||||
print('{0}: Simulators not extracted from makefile:'.format(GEN_SCRIPT_NAME))
|
||||
for orphan in orphans:
|
||||
print('{0}{1}'.format(' ' * 4, orphan))
|
||||
sys.exit(1)
|
||||
else:
|
||||
print('{0}: All simulators present and accounted for!'.format(GEN_SCRIPT_NAME))
|
||||
|
||||
if debug_level >= 1:
|
||||
pp = pprint.PrettyPrinter()
|
||||
|
||||
Reference in New Issue
Block a user