Ignore:
Timestamp:
Aug 27, 2014, 10:50:06 AM (10 years ago)
Author:
cfuguet
Message:

reconfiguration/tsar_generic_iob: using abspath instead of relpath

  • Using absolute paths in the run.py script to allow placing this script anywhere. When passing as argument relpaths, the absolute paths are computed internally
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/reconfiguration/platforms/tsar_generic_iob/scripts/run.py

    r775 r776  
    2222assert len(sys.argv) > 1, "Introduce platform base directory path"
    2323
    24 # goto platform base directory
    25 os.chdir(sys.argv[1])
     24# translate the relative path (if needed) into an absolute path
     25basedir = os.path.abspath(sys.argv[1])
     26print "[ run.py ] platform base directory: {}".format(basedir)
    2627
    2728# repeat while configurations is not empty
    2829for faulty in faultylist:
    2930    for x,y in configs:
    30         confdir = os.getcwd() + "conf/config_{}c/".format(x*y)
     31        confdir = "{}/conf/config_{}c".format(basedir, x*y)
     32        print "[ run.py ] generating files for {}".format(confdir)
    3133
    3234        # 1. generate configuration and ouput directories
    3335        try:
    34             os.makedirs(confdir + "config", 0755)
     36            os.makedirs(confdir + "/config", 0755)
    3537        except OSError:
    3638            pass # directory already exists => do nothing
     
    3840        # 2. generate hard_config.h and fault_config.h files
    3941        arch.main( x = x, y = y, p = nprocs,
    40                    hard_path = confdir + "config/hard_config.h",
    41                    xml_path = confdir + "config/map.xml" )
    42         faultyprocs.generate(faulty, confdir + "config/fault_config.h")
     42                   hard_path = confdir + "/config/hard_config.h",
     43                   xml_path = confdir + "/config/map.xml" )
     44        faultyprocs.generate(faulty, confdir + "/config/fault_config.h")
    4345
    4446        # 3. compile simulator executable
    45         if os.path.exists("hard_config.h"): os.unlink("hard_config.h")
    46         os.symlink(confdir + "config/hard_config.h", "hard_config.h")
    47         subprocess.call("make")
     47        dst = basedir + "/hard_config.h"
     48        if os.path.lexists(dst): os.unlink(dst)
     49        os.symlink(confdir + "/config/hard_config.h", dst)
     50        subprocess.call(["make",
     51            "-C", basedir
     52            ])
    4853
    4954        # 4. compile distributed boot executable
    50         dst = confdir + "config/boot_config.h"
    51         if not os.path.exists(dst):
    52             os.symlink(os.getcwd() + "/soft/config/boot_config.h", dst)
     55        dst = confdir + "/config/boot_config.h"
     56        if os.path.lexists(dst): os.unlink(dst)
     57        os.symlink(basedir + "/soft/config/boot_config.h", dst)
    5358        subprocess.call(["make",
    54             "-C", "soft",
     59            "-C", basedir + "/soft",
    5560            "CONFDIR=" + confdir
    5661            ])
     
    5964        os.environ["DISTRIBUTED_BOOT"] = "1"
    6065        os.environ["SOCLIB_TTY"] = "FILES"
    61         with open(confdir + "log", "w") as log_file:
    62             subprocess.call(["./simul.x",
    63                 "-SOFT"   , "soft/build/soft.elf",
     66        with open(confdir + "/log", "w") as log_file:
     67            subprocess.call([basedir + "/simul.x",
     68                "-SOFT"   , basedir + "/soft/build/soft.elf",
    6469                "-DISK"   , "/dev/null",
    6570                "-NCYCLES", "10000000"],
     
    6974
    7075        # 6. move simulation terminal output into the target config dir
    71         os.rename("term0", confdir + "term")
     76        os.rename("term0", confdir + "/term")
    7277
    7378        # end for each config
Note: See TracChangeset for help on using the changeset viewer.