|
42 | 42 | if __name__ == '__main__':
|
43 | 43 | # Parse Options
|
44 | 44 | parser = get_default_options_parser()
|
45 |
| - parser.add_option("-p", type="int", dest="program", |
| 45 | + parser.add_option("-p", type="int", dest="program", default=-1, |
46 | 46 | help="The index of the desired test program: [0-%d]" % (len(TESTS)-1))
|
47 | 47 | parser.add_option("-n", dest="program_name",
|
48 | 48 | help="The name of the desired test program")
|
|
52 | 52 | help="Add a macro definition")
|
53 | 53 |
|
54 | 54 | # Local run
|
| 55 | + parser.add_option("--automated", action="store_true", dest="automated", |
| 56 | + default=False, help="Automated test") |
| 57 | + parser.add_option("--host", dest="host_test", |
| 58 | + default=None, help="Host test") |
| 59 | + parser.add_option("--extra", dest="extra", |
| 60 | + default=None, help="Extra files") |
| 61 | + parser.add_option("--peripherals", dest="peripherals", |
| 62 | + default=None, help="Required peripherals") |
| 63 | + parser.add_option("--dep", dest="dependencies", |
| 64 | + default=None, help="Dependencies") |
| 65 | + parser.add_option("--source", dest="source_dir", |
| 66 | + default=None, help="The source (input) directory") |
| 67 | + parser.add_option("--duration", type="int", dest="duration", |
| 68 | + default=None, help="Duration of the test") |
| 69 | + parser.add_option("--build", dest="build_dir", |
| 70 | + default=None, help="The build (output) directory") |
55 | 71 | parser.add_option("-d", "--disk", dest="disk",
|
56 | 72 | default=None, help="The mbed disk")
|
57 | 73 | parser.add_option("-s", "--serial", dest="serial",
|
|
69 | 85 | default=None, help="use the specified linker script")
|
70 | 86 |
|
71 | 87 | (options, args) = parser.parse_args()
|
72 |
| - |
| 88 | + |
| 89 | + # force program to "0" if a source dir is specified |
| 90 | + if options.source_dir is not None: |
| 91 | + p = 0 |
| 92 | + n = None |
| 93 | + else: |
73 | 94 | # Program Number or name
|
74 |
| - p, n = options.program, options.program_name |
| 95 | + p, n = options.program, options.program_name |
| 96 | + |
75 | 97 | if n is not None and p is not None:
|
76 | 98 | args_error(parser, "[ERROR] specify either '-n' or '-p', not both")
|
77 | 99 | if n:
|
|
101 | 123 |
|
102 | 124 | # Test
|
103 | 125 | test = Test(p)
|
| 126 | + if options.automated is not None: |
| 127 | + test.automated = options.automated |
| 128 | + if options.dependencies is not None: |
| 129 | + test.dependencies = options.dependencies |
| 130 | + if options.host_test is not None: |
| 131 | + test.host_test = options.host_test; |
| 132 | + if options.peripherals is not None: |
| 133 | + test.peripherals = options.peripherals; |
| 134 | + if options.duration is not None: |
| 135 | + test.duration = options.duration; |
| 136 | + if options.extra is not None: |
| 137 | + test.extra_files = options.extra |
| 138 | + |
104 | 139 | if not test.is_supported(mcu, toolchain):
|
105 | 140 | print 'The selected test is not supported on target %s with toolchain %s' % (mcu, toolchain)
|
106 | 141 | sys.exit()
|
|
110 | 145 | test.dependencies.append(RTOS_LIBRARIES)
|
111 | 146 |
|
112 | 147 | build_dir = join(BUILD_DIR, "test", mcu, toolchain, test.id)
|
| 148 | + if options.source_dir is not None: |
| 149 | + test.source_dir = options.source_dir |
| 150 | + build_dir = options.source_dir |
| 151 | + |
| 152 | + if options.build_dir is not None: |
| 153 | + build_dir = options.build_dir |
113 | 154 |
|
114 | 155 | target = TARGET_MAP[mcu]
|
115 | 156 | try:
|
|
0 commit comments