OLD | NEW |
1 """ | 1 """ |
2 TestCommon.py: a testing framework for commands and scripts | 2 TestCommon.py: a testing framework for commands and scripts |
3 with commonly useful error handling | 3 with commonly useful error handling |
4 | 4 |
5 The TestCommon module provides a simple, high-level interface for writing | 5 The TestCommon module provides a simple, high-level interface for writing |
6 tests of executable commands and scripts, especially commands and scripts | 6 tests of executable commands and scripts, especially commands and scripts |
7 that interact with the file system. All methods throw exceptions and | 7 that interact with the file system. All methods throw exceptions and |
8 exit on failure, with useful error messages. This makes a number of | 8 exit on failure, with useful error messages. This makes a number of |
9 explicit checks unnecessary, making the test scripts themselves simpler | 9 explicit checks unnecessary, making the test scripts themselves simpler |
10 to write and easier to read. | 10 to write and easier to read. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 'shobj_prefix', | 110 'shobj_prefix', |
111 'shobj_suffix', | 111 'shobj_suffix', |
112 'lib_prefix', | 112 'lib_prefix', |
113 'lib_suffix', | 113 'lib_suffix', |
114 'dll_prefix', | 114 'dll_prefix', |
115 'dll_suffix', | 115 'dll_suffix', |
116 ]) | 116 ]) |
117 | 117 |
118 # Variables that describe the prefixes and suffixes on this system. | 118 # Variables that describe the prefixes and suffixes on this system. |
119 if sys.platform == 'win32': | 119 if sys.platform == 'win32': |
120 exe_suffix = '.exe' | 120 exe_suffix = '.exe' |
121 obj_suffix = '.obj' | 121 obj_suffix = '.obj' |
122 shobj_suffix = '.obj' | 122 shobj_suffix = '.obj' |
123 shobj_prefix = '' | 123 shobj_prefix = '' |
124 lib_prefix = '' | 124 lib_prefix = '' |
125 lib_suffix = '.lib' | 125 lib_suffix = '.lib' |
126 dll_prefix = '' | 126 dll_prefix = '' |
127 dll_suffix = '.dll' | 127 dll_suffix = '.dll' |
| 128 module_prefix = '' |
| 129 module_suffix = '.dll' |
128 elif sys.platform == 'cygwin': | 130 elif sys.platform == 'cygwin': |
129 exe_suffix = '.exe' | 131 exe_suffix = '.exe' |
130 obj_suffix = '.o' | 132 obj_suffix = '.o' |
131 shobj_suffix = '.os' | 133 shobj_suffix = '.os' |
132 shobj_prefix = '' | 134 shobj_prefix = '' |
133 lib_prefix = 'lib' | 135 lib_prefix = 'lib' |
134 lib_suffix = '.a' | 136 lib_suffix = '.a' |
135 dll_prefix = '' | 137 dll_prefix = '' |
136 dll_suffix = '.dll' | 138 dll_suffix = '.dll' |
| 139 module_prefix = '' |
| 140 module_suffix = '.dll' |
137 elif string.find(sys.platform, 'irix') != -1: | 141 elif string.find(sys.platform, 'irix') != -1: |
138 exe_suffix = '' | 142 exe_suffix = '' |
139 obj_suffix = '.o' | 143 obj_suffix = '.o' |
140 shobj_suffix = '.o' | 144 shobj_suffix = '.o' |
141 shobj_prefix = '' | 145 shobj_prefix = '' |
142 lib_prefix = 'lib' | 146 lib_prefix = 'lib' |
143 lib_suffix = '.a' | 147 lib_suffix = '.a' |
144 dll_prefix = 'lib' | 148 dll_prefix = 'lib' |
145 dll_suffix = '.so' | 149 dll_suffix = '.so' |
| 150 module_prefix = 'lib' |
| 151 module_prefix = '.so' |
146 elif string.find(sys.platform, 'darwin') != -1: | 152 elif string.find(sys.platform, 'darwin') != -1: |
147 exe_suffix = '' | 153 exe_suffix = '' |
148 obj_suffix = '.o' | 154 obj_suffix = '.o' |
149 shobj_suffix = '.os' | 155 shobj_suffix = '.os' |
150 shobj_prefix = '' | 156 shobj_prefix = '' |
151 lib_prefix = 'lib' | 157 lib_prefix = 'lib' |
152 lib_suffix = '.a' | 158 lib_suffix = '.a' |
153 dll_prefix = 'lib' | 159 dll_prefix = 'lib' |
154 dll_suffix = '.dylib' | 160 dll_suffix = '.dylib' |
| 161 module_prefix = '' |
| 162 module_suffix = '.so' |
155 elif string.find(sys.platform, 'sunos') != -1: | 163 elif string.find(sys.platform, 'sunos') != -1: |
156 exe_suffix = '' | 164 exe_suffix = '' |
157 obj_suffix = '.o' | 165 obj_suffix = '.o' |
158 shobj_suffix = '.os' | 166 shobj_suffix = '.os' |
159 shobj_prefix = 'so_' | 167 shobj_prefix = 'so_' |
160 lib_prefix = 'lib' | 168 lib_prefix = 'lib' |
161 lib_suffix = '.a' | 169 lib_suffix = '.a' |
162 dll_prefix = 'lib' | 170 dll_prefix = 'lib' |
163 dll_suffix = '.dylib' | 171 dll_suffix = '.dylib' |
| 172 module_prefix = '' |
| 173 module_suffix = '.so' |
164 else: | 174 else: |
165 exe_suffix = '' | 175 exe_suffix = '' |
166 obj_suffix = '.o' | 176 obj_suffix = '.o' |
167 shobj_suffix = '.os' | 177 shobj_suffix = '.os' |
168 shobj_prefix = '' | 178 shobj_prefix = '' |
169 lib_prefix = 'lib' | 179 lib_prefix = 'lib' |
170 lib_suffix = '.a' | 180 lib_suffix = '.a' |
171 dll_prefix = 'lib' | 181 dll_prefix = 'lib' |
172 dll_suffix = '.so' | 182 dll_suffix = '.so' |
| 183 module_prefix = 'lib' |
| 184 module_suffix = '.so' |
173 | 185 |
174 def is_List(e): | 186 def is_List(e): |
175 return type(e) is types.ListType \ | 187 return type(e) is types.ListType \ |
176 or isinstance(e, UserList.UserList) | 188 or isinstance(e, UserList.UserList) |
177 | 189 |
178 def is_writable(f): | 190 def is_writable(f): |
179 mode = os.stat(f)[stat.ST_MODE] | 191 mode = os.stat(f)[stat.ST_MODE] |
180 return mode & stat.S_IWUSR | 192 return mode & stat.S_IWUSR |
181 | 193 |
182 def separate_files(flist): | 194 def separate_files(flist): |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 else: | 573 else: |
562 # We're under the development directory for this change, | 574 # We're under the development directory for this change, |
563 # so this is an Aegis invocation; pass the test (exit 0). | 575 # so this is an Aegis invocation; pass the test (exit 0). |
564 self.pass_test() | 576 self.pass_test() |
565 | 577 |
566 # Local Variables: | 578 # Local Variables: |
567 # tab-width:4 | 579 # tab-width:4 |
568 # indent-tabs-mode:nil | 580 # indent-tabs-mode:nil |
569 # End: | 581 # End: |
570 # vim: set expandtab tabstop=4 shiftwidth=4: | 582 # vim: set expandtab tabstop=4 shiftwidth=4: |
OLD | NEW |