Use some python os.path stuff to make it more flexible where we can execute this script from.

--HG--
extra : convert_revision : a76861a0f2669a7cd3bf3a34177739c69a913545
This commit is contained in:
Kevin Lim 2006-10-30 14:01:34 -05:00
parent 9be53b10b3
commit bc93802fb8
2 changed files with 12 additions and 4 deletions

View file

@ -39,6 +39,10 @@ import Simulation
if not m5.build_env['FULL_SYSTEM']:
m5.panic("This script requires full-system mode (ALPHA_FS).")
# Get paths we might need. It's expected this file is in m5/configs/example.
config_path = os.path.dirname(os.path.abspath(__file__))
config_root = os.path.dirname(config_path)
parser = optparse.OptionParser()
# Benchmark options
@ -54,8 +58,7 @@ parser.add_option("--etherdump", action="store", type="string", dest="etherdump"
help="Specify the filename to dump a pcap capture of the" \
"ethernet traffic")
execfile("Options.py")
execfile(os.path.join(config_root, "common", "Options.py"))
(options, args) = parser.parse_args()

View file

@ -36,11 +36,16 @@ import os, optparse, sys
m5.AddToPath('../common')
import Simulation
# Get paths we might need. It's expected this file is in m5/configs/example.
config_path = os.path.dirname(os.path.abspath(__file__))
config_root = os.path.dirname(config_path)
m5_root = os.path.dirname(config_root)
parser = optparse.OptionParser()
# Benchmark options
parser.add_option("-c", "--cmd",
default="../../tests/test-progs/hello/bin/alpha/linux/hello",
default=os.path.join(m5_root, "tests/test-progs/hello/bin/alpha/linux/hello"),
help="The binary to run in syscall emulation mode.")
parser.add_option("-o", "--options", default="",
help="The options to pass to the binary, use \" \" around the entire\
@ -48,7 +53,7 @@ parser.add_option("-o", "--options", default="",
parser.add_option("-i", "--input", default="",
help="A file of input to give to the binary.")
execfile("Options.py")
execfile(os.path.join(config_root, "common", "Options.py"))
(options, args) = parser.parse_args()