@@ -96,21 +96,30 @@ def list_presets(options):
96
96
stderr = subprocess .STDOUT ).stdout
97
97
return guess_presets_from_help (help_text .decode ('ascii' ))
98
98
99
- def run_one (options , args ):
99
+ def run_one (options , args , stem_prefix = '' , input_file = None ):
100
100
"""Run the config script with the given arguments.
101
101
102
- Write the following files:
102
+ Take the original content from input_file if specified, defaulting
103
+ to options.input_file if input_file is None.
104
+
105
+ Write the following files, where xxx contains stem_prefix followed by
106
+ a filename-friendly encoding of args:
103
107
* config-xxx.h: modified file.
104
108
* config-xxx.out: standard output.
105
109
* config-xxx.err: standard output.
106
110
* config-xxx.status: exit code.
111
+
112
+ Return ("xxx+", "path/to/config-xxx.h") which can be used as
113
+ stem_prefix and input_file to call this function again with new args.
107
114
"""
108
- stem = '-' .join (args )
115
+ if input_file is None :
116
+ input_file = options .input_file
117
+ stem = stem_prefix + '-' .join (args )
109
118
data_filename = output_file_name (options .output_directory , stem , 'h' )
110
119
stdout_filename = output_file_name (options .output_directory , stem , 'out' )
111
120
stderr_filename = output_file_name (options .output_directory , stem , 'err' )
112
121
status_filename = output_file_name (options .output_directory , stem , 'status' )
113
- shutil .copy (options . input_file , data_filename )
122
+ shutil .copy (input_file , data_filename )
114
123
# Pass only the file basename, not the full path, to avoid getting the
115
124
# directory name in error messages, which would make comparisons
116
125
# between output directories more difficult.
@@ -124,6 +133,7 @@ def run_one(options, args):
124
133
stdout = out , stderr = err )
125
134
with open (status_filename , 'w' ) as status_file :
126
135
status_file .write ('{}\n ' .format (status ))
136
+ return stem + "+" , data_filename
127
137
128
138
### A list of symbols to test with.
129
139
### This script currently tests what happens when you change a symbol from
@@ -145,9 +155,11 @@ def run_all(options):
145
155
run_one (options , [preset ])
146
156
for symbol in TEST_SYMBOLS :
147
157
run_one (options , ['get' , symbol ])
148
- run_one (options , ['set' , symbol ])
158
+ (stem , filename ) = run_one (options , ['set' , symbol ])
159
+ run_one (options , ['get' , symbol ], stem_prefix = stem , input_file = filename )
149
160
run_one (options , ['--force' , 'set' , symbol ])
150
- run_one (options , ['set' , symbol , 'value' ])
161
+ (stem , filename ) = run_one (options , ['set' , symbol , 'value' ])
162
+ run_one (options , ['get' , symbol ], stem_prefix = stem , input_file = filename )
151
163
run_one (options , ['--force' , 'set' , symbol , 'value' ])
152
164
run_one (options , ['unset' , symbol ])
153
165
0 commit comments