Last change
on this file since 924 was
902,
checked in by cfuguet, 10 years ago
|
reconf: improve the random fault generation
- Improve portability of python scripts by using env
|
File size:
877 bytes
|
Rev | Line | |
---|
[902] | 1 | #!/usr/bin/env python |
---|
[775] | 2 | # @date 26 August, 2014 |
---|
| 3 | # @author cfuguet <cesar.fuguet-tortolero@lip6.fr> |
---|
| 4 | |
---|
| 5 | import sys |
---|
| 6 | |
---|
| 7 | def generate(faulty, outpath): |
---|
| 8 | content = [] |
---|
| 9 | content.append( "#ifndef FAULT_CONFIG_H\n" |
---|
| 10 | "#define FAULT_CONFIG_H\n" |
---|
| 11 | "static const int faulty_proc_ids[] =\n" |
---|
| 12 | "{\n" |
---|
| 13 | " /* X | Y | L */\n") |
---|
| 14 | |
---|
[890] | 15 | if faulty != None: |
---|
| 16 | for x, y, l in faulty: |
---|
| 17 | content.append(" ({0} << 6) | ({1} << 2) | {2},\n".format(x, y, l)) |
---|
[775] | 18 | |
---|
| 19 | content.append( "};\n" |
---|
| 20 | "#endif\n") |
---|
| 21 | |
---|
| 22 | with open(outpath, "w") as outfile: |
---|
| 23 | outfile.writelines(content) |
---|
| 24 | |
---|
| 25 | if __name__ == "__main__": |
---|
| 26 | faulty = [ (0,0,1), (0,1,1), (1,0,1), (1,0,2), (1,0,3), (1,1,1), (1,1,3)] |
---|
| 27 | generate(faulty, "fault.gen.h") |
---|
| 28 | |
---|
| 29 | # vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab |
---|
Note: See
TracBrowser
for help on using the repository browser.