diff options
Diffstat (limited to 'lib/tests')
-rw-r--r-- | lib/tests/test_base64.c | 271 | ||||
-rw-r--r-- | lib/tests/test_cmd.c | 41 | ||||
-rw-r--r-- | lib/tests/test_generic_output.c | 6 | ||||
-rw-r--r-- | lib/tests/test_ini1.c | 54 | ||||
-rw-r--r-- | lib/tests/test_opts1.c | 51 | ||||
-rw-r--r-- | lib/tests/test_opts2.c | 86 | ||||
-rw-r--r-- | lib/tests/test_tcp.c | 28 |
7 files changed, 322 insertions, 215 deletions
diff --git a/lib/tests/test_base64.c b/lib/tests/test_base64.c index 94cb5aa9..798244da 100644 --- a/lib/tests/test_base64.c +++ b/lib/tests/test_base64.c | |||
@@ -180,117 +180,168 @@ int main(int argc, char **argv) { | |||
180 | #endif | 180 | #endif |
181 | 181 | ||
182 | char random[1024] = { | 182 | char random[1024] = { |
183 | 0x0b, 0x30, 0x44, 0x62, 0x7c, 0x22, 0x1f, 0x0d, 0x05, 0x67, 0x2c, 0x2a, 0x39, 0x21, 0x46, 0x08, 0x50, 0x66, 0x34, 0x37, 0x0b, 0x45, | 183 | 0x0b, 0x30, 0x44, 0x62, 0x7c, 0x22, 0x1f, 0x0d, 0x05, 0x67, 0x2c, 0x2a, 0x39, 0x21, 0x46, |
184 | 0x4b, 0x38, 0x32, 0x06, 0x7a, 0x3e, 0x7f, 0x0c, 0x40, 0x18, 0x6b, 0x2d, 0x60, 0x4c, 0x60, 0x0c, 0x23, 0x43, 0x3b, 0x3e, 0x1b, 0x16, | 184 | 0x08, 0x50, 0x66, 0x34, 0x37, 0x0b, 0x45, 0x4b, 0x38, 0x32, 0x06, 0x7a, 0x3e, 0x7f, 0x0c, |
185 | 0x04, 0x46, 0x58, 0x3f, 0x40, 0x6a, 0x11, 0x05, 0x63, 0x71, 0x14, 0x35, 0x47, 0x79, 0x13, 0x6f, 0x6b, 0x27, 0x18, 0x5b, 0x48, 0x27, | 185 | 0x40, 0x18, 0x6b, 0x2d, 0x60, 0x4c, 0x60, 0x0c, 0x23, 0x43, 0x3b, 0x3e, 0x1b, 0x16, 0x04, |
186 | 0x3e, 0x6f, 0x15, 0x33, 0x4f, 0x3e, 0x5e, 0x51, 0x73, 0x68, 0x25, 0x0f, 0x06, 0x5b, 0x7c, 0x72, 0x75, 0x3e, 0x3f, 0x1b, 0x5c, 0x6d, | 186 | 0x46, 0x58, 0x3f, 0x40, 0x6a, 0x11, 0x05, 0x63, 0x71, 0x14, 0x35, 0x47, 0x79, 0x13, 0x6f, |
187 | 0x6a, 0x39, 0x7c, 0x63, 0x63, 0x60, 0x6c, 0x7a, 0x33, 0x76, 0x52, 0x13, 0x25, 0x33, 0x7d, 0x65, 0x23, 0x27, 0x11, 0x06, 0x06, 0x47, | 187 | 0x6b, 0x27, 0x18, 0x5b, 0x48, 0x27, 0x3e, 0x6f, 0x15, 0x33, 0x4f, 0x3e, 0x5e, 0x51, 0x73, |
188 | 0x71, 0x1e, 0x14, 0x74, 0x63, 0x70, 0x2d, 0x15, 0x27, 0x18, 0x51, 0x06, 0x05, 0x33, 0x11, 0x2c, 0x6b, 0x00, 0x2d, 0x77, 0x20, 0x48, | 188 | 0x68, 0x25, 0x0f, 0x06, 0x5b, 0x7c, 0x72, 0x75, 0x3e, 0x3f, 0x1b, 0x5c, 0x6d, 0x6a, 0x39, |
189 | 0x0d, 0x73, 0x51, 0x45, 0x25, 0x7f, 0x7f, 0x35, 0x26, 0x2e, 0x26, 0x53, 0x24, 0x68, 0x1e, 0x0e, 0x58, 0x3a, 0x59, 0x50, 0x56, 0x37, | 189 | 0x7c, 0x63, 0x63, 0x60, 0x6c, 0x7a, 0x33, 0x76, 0x52, 0x13, 0x25, 0x33, 0x7d, 0x65, 0x23, |
190 | 0x5f, 0x66, 0x01, 0x4c, 0x5a, 0x64, 0x32, 0x50, 0x7b, 0x6a, 0x20, 0x72, 0x2b, 0x1d, 0x7e, 0x43, 0x7b, 0x61, 0x42, 0x0b, 0x61, 0x73, | 190 | 0x27, 0x11, 0x06, 0x06, 0x47, 0x71, 0x1e, 0x14, 0x74, 0x63, 0x70, 0x2d, 0x15, 0x27, 0x18, |
191 | 0x24, 0x79, 0x3a, 0x6b, 0x4a, 0x79, 0x6e, 0x09, 0x0f, 0x27, 0x2d, 0x0c, 0x5e, 0x32, 0x4b, 0x0d, 0x79, 0x46, 0x39, 0x21, 0x0a, 0x26, | 191 | 0x51, 0x06, 0x05, 0x33, 0x11, 0x2c, 0x6b, 0x00, 0x2d, 0x77, 0x20, 0x48, 0x0d, 0x73, 0x51, |
192 | 0x5f, 0x3a, 0x00, 0x26, 0x3f, 0x13, 0x2e, 0x7e, 0x50, 0x2b, 0x67, 0x46, 0x72, 0x3f, 0x3b, 0x01, 0x46, 0x1b, 0x0b, 0x35, 0x49, 0x39, | 192 | 0x45, 0x25, 0x7f, 0x7f, 0x35, 0x26, 0x2e, 0x26, 0x53, 0x24, 0x68, 0x1e, 0x0e, 0x58, 0x3a, |
193 | 0x19, 0x70, 0x3d, 0x02, 0x41, 0x0e, 0x38, 0x05, 0x76, 0x65, 0x4f, 0x31, 0x6c, 0x5e, 0x17, 0x04, 0x15, 0x36, 0x26, 0x64, 0x34, 0x14, | 193 | 0x59, 0x50, 0x56, 0x37, 0x5f, 0x66, 0x01, 0x4c, 0x5a, 0x64, 0x32, 0x50, 0x7b, 0x6a, 0x20, |
194 | 0x17, 0x7c, 0x0e, 0x0b, 0x5b, 0x55, 0x53, 0x6b, 0x00, 0x42, 0x41, 0x4f, 0x02, 0x5c, 0x13, 0x0a, 0x2c, 0x2c, 0x3e, 0x10, 0x14, 0x33, | 194 | 0x72, 0x2b, 0x1d, 0x7e, 0x43, 0x7b, 0x61, 0x42, 0x0b, 0x61, 0x73, 0x24, 0x79, 0x3a, 0x6b, |
195 | 0x45, 0x7c, 0x7a, 0x5a, 0x31, 0x61, 0x39, 0x08, 0x22, 0x6a, 0x1e, 0x0f, 0x6f, 0x1b, 0x6c, 0x13, 0x5e, 0x79, 0x20, 0x79, 0x50, 0x62, | 195 | 0x4a, 0x79, 0x6e, 0x09, 0x0f, 0x27, 0x2d, 0x0c, 0x5e, 0x32, 0x4b, 0x0d, 0x79, 0x46, 0x39, |
196 | 0x06, 0x2c, 0x76, 0x17, 0x04, 0x2b, 0x2a, 0x75, 0x1f, 0x0c, 0x37, 0x4e, 0x0f, 0x7b, 0x2d, 0x34, 0x75, 0x60, 0x31, 0x74, 0x2e, 0x0a, | 196 | 0x21, 0x0a, 0x26, 0x5f, 0x3a, 0x00, 0x26, 0x3f, 0x13, 0x2e, 0x7e, 0x50, 0x2b, 0x67, 0x46, |
197 | 0x4a, 0x11, 0x6c, 0x49, 0x25, 0x01, 0x3a, 0x3d, 0x22, 0x1e, 0x6d, 0x18, 0x51, 0x78, 0x2d, 0x62, 0x31, 0x4c, 0x50, 0x40, 0x17, 0x4b, | 197 | 0x72, 0x3f, 0x3b, 0x01, 0x46, 0x1b, 0x0b, 0x35, 0x49, 0x39, 0x19, 0x70, 0x3d, 0x02, 0x41, |
198 | 0x6f, 0x22, 0x00, 0x7f, 0x61, 0x2a, 0x34, 0x3e, 0x00, 0x5f, 0x2f, 0x5f, 0x2f, 0x14, 0x2a, 0x55, 0x27, 0x1f, 0x46, 0x1f, 0x12, 0x46, | 198 | 0x0e, 0x38, 0x05, 0x76, 0x65, 0x4f, 0x31, 0x6c, 0x5e, 0x17, 0x04, 0x15, 0x36, 0x26, 0x64, |
199 | 0x5e, 0x1e, 0x0c, 0x7c, 0x38, 0x01, 0x61, 0x64, 0x76, 0x22, 0x6e, 0x08, 0x20, 0x38, 0x4f, 0x73, 0x72, 0x55, 0x12, 0x42, 0x19, 0x50, | 199 | 0x34, 0x14, 0x17, 0x7c, 0x0e, 0x0b, 0x5b, 0x55, 0x53, 0x6b, 0x00, 0x42, 0x41, 0x4f, 0x02, |
200 | 0x61, 0x43, 0x77, 0x7d, 0x41, 0x2e, 0x35, 0x4f, 0x3d, 0x31, 0x28, 0x58, 0x67, 0x1b, 0x03, 0x51, 0x20, 0x32, 0x1c, 0x08, 0x6e, 0x37, | 200 | 0x5c, 0x13, 0x0a, 0x2c, 0x2c, 0x3e, 0x10, 0x14, 0x33, 0x45, 0x7c, 0x7a, 0x5a, 0x31, 0x61, |
201 | 0x75, 0x37, 0x44, 0x4f, 0x68, 0x19, 0x07, 0x64, 0x14, 0x28, 0x25, 0x2b, 0x69, 0x35, 0x18, 0x27, 0x26, 0x14, 0x13, 0x70, 0x42, 0x19, | 201 | 0x39, 0x08, 0x22, 0x6a, 0x1e, 0x0f, 0x6f, 0x1b, 0x6c, 0x13, 0x5e, 0x79, 0x20, 0x79, 0x50, |
202 | 0x12, 0x75, 0x3e, 0x02, 0x5d, 0x7c, 0x13, 0x1f, 0x16, 0x53, 0x3b, 0x74, 0x48, 0x3c, 0x5e, 0x39, 0x6c, 0x1c, 0x1c, 0x74, 0x39, 0x1f, | 202 | 0x62, 0x06, 0x2c, 0x76, 0x17, 0x04, 0x2b, 0x2a, 0x75, 0x1f, 0x0c, 0x37, 0x4e, 0x0f, 0x7b, |
203 | 0x00, 0x1b, 0x06, 0x0a, 0x68, 0x3b, 0x52, 0x4f, 0x1e, 0x6e, 0x3c, 0x35, 0x0c, 0x38, 0x0e, 0x0b, 0x3b, 0x1a, 0x76, 0x23, 0x29, 0x53, | 203 | 0x2d, 0x34, 0x75, 0x60, 0x31, 0x74, 0x2e, 0x0a, 0x4a, 0x11, 0x6c, 0x49, 0x25, 0x01, 0x3a, |
204 | 0x1e, 0x5f, 0x41, 0x0c, 0x4b, 0x0a, 0x65, 0x28, 0x78, 0x67, 0x48, 0x59, 0x26, 0x6d, 0x31, 0x76, 0x23, 0x70, 0x61, 0x64, 0x3b, 0x38, | 204 | 0x3d, 0x22, 0x1e, 0x6d, 0x18, 0x51, 0x78, 0x2d, 0x62, 0x31, 0x4c, 0x50, 0x40, 0x17, 0x4b, |
205 | 0x79, 0x66, 0x74, 0x53, 0x2c, 0x64, 0x64, 0x54, 0x03, 0x54, 0x65, 0x44, 0x4c, 0x18, 0x4f, 0x48, 0x20, 0x4f, 0x72, 0x10, 0x3f, 0x0c, | 205 | 0x6f, 0x22, 0x00, 0x7f, 0x61, 0x2a, 0x34, 0x3e, 0x00, 0x5f, 0x2f, 0x5f, 0x2f, 0x14, 0x2a, |
206 | 0x52, 0x2d, 0x03, 0x14, 0x03, 0x51, 0x42, 0x10, 0x77, 0x6a, 0x34, 0x06, 0x32, 0x03, 0x72, 0x14, 0x7c, 0x08, 0x5d, 0x52, 0x1a, 0x62, | 206 | 0x55, 0x27, 0x1f, 0x46, 0x1f, 0x12, 0x46, 0x5e, 0x1e, 0x0c, 0x7c, 0x38, 0x01, 0x61, 0x64, |
207 | 0x7c, 0x3e, 0x30, 0x7e, 0x5f, 0x7f, 0x54, 0x0f, 0x44, 0x49, 0x5d, 0x5e, 0x10, 0x6a, 0x06, 0x2b, 0x06, 0x53, 0x10, 0x39, 0x37, 0x32, | 207 | 0x76, 0x22, 0x6e, 0x08, 0x20, 0x38, 0x4f, 0x73, 0x72, 0x55, 0x12, 0x42, 0x19, 0x50, 0x61, |
208 | 0x4a, 0x4e, 0x3d, 0x2b, 0x65, 0x38, 0x39, 0x07, 0x72, 0x54, 0x64, 0x4d, 0x56, 0x6a, 0x03, 0x22, 0x70, 0x7b, 0x5f, 0x60, 0x0b, 0x2a, | 208 | 0x43, 0x77, 0x7d, 0x41, 0x2e, 0x35, 0x4f, 0x3d, 0x31, 0x28, 0x58, 0x67, 0x1b, 0x03, 0x51, |
209 | 0x0b, 0x6b, 0x10, 0x64, 0x14, 0x05, 0x22, 0x00, 0x73, 0x40, 0x23, 0x5b, 0x51, 0x1f, 0x2b, 0x1a, 0x5d, 0x69, 0x7a, 0x46, 0x0c, 0x5f, | 209 | 0x20, 0x32, 0x1c, 0x08, 0x6e, 0x37, 0x75, 0x37, 0x44, 0x4f, 0x68, 0x19, 0x07, 0x64, 0x14, |
210 | 0x32, 0x4b, 0x4a, 0x28, 0x52, 0x79, 0x5b, 0x12, 0x42, 0x18, 0x00, 0x5d, 0x27, 0x31, 0x53, 0x3c, 0x4c, 0x36, 0x4e, 0x38, 0x3f, 0x72, | 210 | 0x28, 0x25, 0x2b, 0x69, 0x35, 0x18, 0x27, 0x26, 0x14, 0x13, 0x70, 0x42, 0x19, 0x12, 0x75, |
211 | 0x03, 0x71, 0x02, 0x5b, 0x36, 0x59, 0x7f, 0x75, 0x6e, 0x08, 0x54, 0x0d, 0x34, 0x1c, 0x34, 0x57, 0x5d, 0x69, 0x48, 0x00, 0x3b, 0x05, | 211 | 0x3e, 0x02, 0x5d, 0x7c, 0x13, 0x1f, 0x16, 0x53, 0x3b, 0x74, 0x48, 0x3c, 0x5e, 0x39, 0x6c, |
212 | 0x07, 0x6e, 0x27, 0x65, 0x6e, 0x40, 0x3d, 0x3a, 0x4f, 0x72, 0x5d, 0x39, 0x16, 0x0f, 0x63, 0x12, 0x12, 0x15, 0x3a, 0x70, 0x0d, 0x57, | 212 | 0x1c, 0x1c, 0x74, 0x39, 0x1f, 0x00, 0x1b, 0x06, 0x0a, 0x68, 0x3b, 0x52, 0x4f, 0x1e, 0x6e, |
213 | 0x18, 0x0d, 0x5e, 0x3d, 0x22, 0x68, 0x68, 0x7c, 0x6d, 0x4f, 0x0c, 0x7b, 0x09, 0x2d, 0x4a, 0x73, 0x20, 0x47, 0x07, 0x57, 0x75, 0x5d, | 213 | 0x3c, 0x35, 0x0c, 0x38, 0x0e, 0x0b, 0x3b, 0x1a, 0x76, 0x23, 0x29, 0x53, 0x1e, 0x5f, 0x41, |
214 | 0x53, 0x70, 0x34, 0x21, 0x40, 0x57, 0x51, 0x5e, 0x49, 0x44, 0x00, 0x54, 0x27, 0x04, 0x68, 0x7e, 0x59, 0x56, 0x58, 0x74, 0x14, 0x3c, | 214 | 0x0c, 0x4b, 0x0a, 0x65, 0x28, 0x78, 0x67, 0x48, 0x59, 0x26, 0x6d, 0x31, 0x76, 0x23, 0x70, |
215 | 0x16, 0x33, 0x41, 0x16, 0x4b, 0x2f, 0x49, 0x37, 0x0a, 0x54, 0x08, 0x08, 0x1f, 0x39, 0x67, 0x76, 0x28, 0x28, 0x07, 0x1d, 0x61, 0x47, | 215 | 0x61, 0x64, 0x3b, 0x38, 0x79, 0x66, 0x74, 0x53, 0x2c, 0x64, 0x64, 0x54, 0x03, 0x54, 0x65, |
216 | 0x51, 0x4d, 0x75, 0x26, 0x52, 0x47, 0x47, 0x0c, 0x57, 0x58, 0x74, 0x3e, 0x62, 0x6c, 0x58, 0x3a, 0x44, 0x1e, 0x16, 0x2e, 0x21, 0x1c, | 216 | 0x44, 0x4c, 0x18, 0x4f, 0x48, 0x20, 0x4f, 0x72, 0x10, 0x3f, 0x0c, 0x52, 0x2d, 0x03, 0x14, |
217 | 0x73, 0x45, 0x67, 0x74, 0x4f, 0x33, 0x66, 0x0e, 0x74, 0x66, 0x26, 0x1f, 0x2e, 0x38, 0x44, 0x40, 0x7e, 0x2a, 0x50, 0x52, 0x5e, 0x43, | 217 | 0x03, 0x51, 0x42, 0x10, 0x77, 0x6a, 0x34, 0x06, 0x32, 0x03, 0x72, 0x14, 0x7c, 0x08, 0x5d, |
218 | 0x01, 0x7a, 0x38, 0x49, 0x3c, 0x55, 0x4d, 0x5a, 0x44, 0x08, 0x26, 0x59, 0x4d, 0x45, 0x0b, 0x48, 0x0a, 0x33, 0x5e, 0x4a, 0x4d, 0x75, | 218 | 0x52, 0x1a, 0x62, 0x7c, 0x3e, 0x30, 0x7e, 0x5f, 0x7f, 0x54, 0x0f, 0x44, 0x49, 0x5d, 0x5e, |
219 | 0x16, 0x17, 0x63, 0x46, 0x01, 0x2a, 0x55, 0x7b, 0x0f, 0x02, 0x73, 0x6a, 0x4b, 0x7f, 0x75, 0x65, 0x3c, 0x4c, 0x33, 0x39, 0x6c, 0x74, | 219 | 0x10, 0x6a, 0x06, 0x2b, 0x06, 0x53, 0x10, 0x39, 0x37, 0x32, 0x4a, 0x4e, 0x3d, 0x2b, 0x65, |
220 | 0x05, 0x60, 0x0f, 0x7f, 0x2d, 0x41, 0x4d, 0x4d, 0x46, 0x71, 0x09, 0x6f, 0x4f, 0x60, 0x15, 0x0f, 0x46, 0x73, 0x63, 0x4c, 0x5e, 0x74, | 220 | 0x38, 0x39, 0x07, 0x72, 0x54, 0x64, 0x4d, 0x56, 0x6a, 0x03, 0x22, 0x70, 0x7b, 0x5f, 0x60, |
221 | 0x30, 0x0d, 0x28, 0x43, 0x08, 0x72, 0x32, 0x04, 0x2e, 0x31, 0x29, 0x27, 0x44, 0x6d, 0x13, 0x17, 0x48, 0x0f, 0x49, 0x52, 0x10, 0x13, | 221 | 0x0b, 0x2a, 0x0b, 0x6b, 0x10, 0x64, 0x14, 0x05, 0x22, 0x00, 0x73, 0x40, 0x23, 0x5b, 0x51, |
222 | 0x7f, 0x17, 0x16, 0x62, 0x79, 0x35, 0x78, 0x3e, 0x01, 0x7c, 0x2e, 0x0f, 0x76, 0x3e, 0x5e, 0x53, 0x6c, 0x5b, 0x5f, 0x7c, 0x19, 0x41, | 222 | 0x1f, 0x2b, 0x1a, 0x5d, 0x69, 0x7a, 0x46, 0x0c, 0x5f, 0x32, 0x4b, 0x4a, 0x28, 0x52, 0x79, |
223 | 0x02, 0x2f, 0x17, 0x64, 0x41, 0x75, 0x10, 0x04, 0x47, 0x7c, 0x3d, 0x4b, 0x52, 0x00, 0x10, 0x5d, 0x51, 0x4e, 0x7a, 0x27, 0x25, 0x55, | 223 | 0x5b, 0x12, 0x42, 0x18, 0x00, 0x5d, 0x27, 0x31, 0x53, 0x3c, 0x4c, 0x36, 0x4e, 0x38, 0x3f, |
224 | 0x40, 0x12, 0x35, 0x60, 0x05, 0x1b, 0x34, 0x2d, 0x04, 0x7a, 0x6a, 0x69, 0x02, 0x79, 0x03, 0x3a, 0x2f, 0x06, 0x0a, 0x79, 0x7b, 0x12, | 224 | 0x72, 0x03, 0x71, 0x02, 0x5b, 0x36, 0x59, 0x7f, 0x75, 0x6e, 0x08, 0x54, 0x0d, 0x34, 0x1c, |
225 | 0x5d, 0x7c, 0x52, 0x29, 0x47, 0x58, 0x12, 0x73, 0x3f, 0x27, 0x56, 0x05, 0x0c, 0x48, 0x32, 0x58, 0x6b, 0x57, 0x5c, 0x03, 0x64, 0x56, | 225 | 0x34, 0x57, 0x5d, 0x69, 0x48, 0x00, 0x3b, 0x05, 0x07, 0x6e, 0x27, 0x65, 0x6e, 0x40, 0x3d, |
226 | 0x11, 0x52, 0x7a, 0x30, 0x36, 0x29, 0x17, 0x3b, 0x68, 0x7a, 0x7c, 0x05, 0x6b, 0x6b, 0x13, 0x6a, 0x24, 0x5c, 0x68, 0x42, 0x18, 0x32, | 226 | 0x3a, 0x4f, 0x72, 0x5d, 0x39, 0x16, 0x0f, 0x63, 0x12, 0x12, 0x15, 0x3a, 0x70, 0x0d, 0x57, |
227 | 0x03, 0x73, 0x6e, 0x04, 0x21, 0x2e, 0x01, 0x04, 0x63, 0x7d, 0x44, 0x41, 0x12, 0x31, 0x0b, 0x15, 0x1f, 0x70, 0x00, 0x2e, 0x66, 0x14, | 227 | 0x18, 0x0d, 0x5e, 0x3d, 0x22, 0x68, 0x68, 0x7c, 0x6d, 0x4f, 0x0c, 0x7b, 0x09, 0x2d, 0x4a, |
228 | 0x3c, 0x7f, 0x2b, 0x00, 0x1f, 0x0c, 0x28, 0x59, 0x0a, 0x16, 0x49, 0x5a, 0x5c, 0x64, 0x65, 0x4b, 0x11, 0x29, 0x15, 0x36, 0x5a, 0x65, | 228 | 0x73, 0x20, 0x47, 0x07, 0x57, 0x75, 0x5d, 0x53, 0x70, 0x34, 0x21, 0x40, 0x57, 0x51, 0x5e, |
229 | 0x19, 0x4f, 0x60, 0x23, 0x3a, 0x3a, 0x13, 0x25, 0x02, 0x78, 0x4c, 0x54}; | 229 | 0x49, 0x44, 0x00, 0x54, 0x27, 0x04, 0x68, 0x7e, 0x59, 0x56, 0x58, 0x74, 0x14, 0x3c, 0x16, |
230 | 0x33, 0x41, 0x16, 0x4b, 0x2f, 0x49, 0x37, 0x0a, 0x54, 0x08, 0x08, 0x1f, 0x39, 0x67, 0x76, | ||
231 | 0x28, 0x28, 0x07, 0x1d, 0x61, 0x47, 0x51, 0x4d, 0x75, 0x26, 0x52, 0x47, 0x47, 0x0c, 0x57, | ||
232 | 0x58, 0x74, 0x3e, 0x62, 0x6c, 0x58, 0x3a, 0x44, 0x1e, 0x16, 0x2e, 0x21, 0x1c, 0x73, 0x45, | ||
233 | 0x67, 0x74, 0x4f, 0x33, 0x66, 0x0e, 0x74, 0x66, 0x26, 0x1f, 0x2e, 0x38, 0x44, 0x40, 0x7e, | ||
234 | 0x2a, 0x50, 0x52, 0x5e, 0x43, 0x01, 0x7a, 0x38, 0x49, 0x3c, 0x55, 0x4d, 0x5a, 0x44, 0x08, | ||
235 | 0x26, 0x59, 0x4d, 0x45, 0x0b, 0x48, 0x0a, 0x33, 0x5e, 0x4a, 0x4d, 0x75, 0x16, 0x17, 0x63, | ||
236 | 0x46, 0x01, 0x2a, 0x55, 0x7b, 0x0f, 0x02, 0x73, 0x6a, 0x4b, 0x7f, 0x75, 0x65, 0x3c, 0x4c, | ||
237 | 0x33, 0x39, 0x6c, 0x74, 0x05, 0x60, 0x0f, 0x7f, 0x2d, 0x41, 0x4d, 0x4d, 0x46, 0x71, 0x09, | ||
238 | 0x6f, 0x4f, 0x60, 0x15, 0x0f, 0x46, 0x73, 0x63, 0x4c, 0x5e, 0x74, 0x30, 0x0d, 0x28, 0x43, | ||
239 | 0x08, 0x72, 0x32, 0x04, 0x2e, 0x31, 0x29, 0x27, 0x44, 0x6d, 0x13, 0x17, 0x48, 0x0f, 0x49, | ||
240 | 0x52, 0x10, 0x13, 0x7f, 0x17, 0x16, 0x62, 0x79, 0x35, 0x78, 0x3e, 0x01, 0x7c, 0x2e, 0x0f, | ||
241 | 0x76, 0x3e, 0x5e, 0x53, 0x6c, 0x5b, 0x5f, 0x7c, 0x19, 0x41, 0x02, 0x2f, 0x17, 0x64, 0x41, | ||
242 | 0x75, 0x10, 0x04, 0x47, 0x7c, 0x3d, 0x4b, 0x52, 0x00, 0x10, 0x5d, 0x51, 0x4e, 0x7a, 0x27, | ||
243 | 0x25, 0x55, 0x40, 0x12, 0x35, 0x60, 0x05, 0x1b, 0x34, 0x2d, 0x04, 0x7a, 0x6a, 0x69, 0x02, | ||
244 | 0x79, 0x03, 0x3a, 0x2f, 0x06, 0x0a, 0x79, 0x7b, 0x12, 0x5d, 0x7c, 0x52, 0x29, 0x47, 0x58, | ||
245 | 0x12, 0x73, 0x3f, 0x27, 0x56, 0x05, 0x0c, 0x48, 0x32, 0x58, 0x6b, 0x57, 0x5c, 0x03, 0x64, | ||
246 | 0x56, 0x11, 0x52, 0x7a, 0x30, 0x36, 0x29, 0x17, 0x3b, 0x68, 0x7a, 0x7c, 0x05, 0x6b, 0x6b, | ||
247 | 0x13, 0x6a, 0x24, 0x5c, 0x68, 0x42, 0x18, 0x32, 0x03, 0x73, 0x6e, 0x04, 0x21, 0x2e, 0x01, | ||
248 | 0x04, 0x63, 0x7d, 0x44, 0x41, 0x12, 0x31, 0x0b, 0x15, 0x1f, 0x70, 0x00, 0x2e, 0x66, 0x14, | ||
249 | 0x3c, 0x7f, 0x2b, 0x00, 0x1f, 0x0c, 0x28, 0x59, 0x0a, 0x16, 0x49, 0x5a, 0x5c, 0x64, 0x65, | ||
250 | 0x4b, 0x11, 0x29, 0x15, 0x36, 0x5a, 0x65, 0x19, 0x4f, 0x60, 0x23, 0x3a, 0x3a, 0x13, 0x25, | ||
251 | 0x02, 0x78, 0x4c, 0x54}; | ||
230 | char b64_known[1369] = { | 252 | char b64_known[1369] = { |
231 | 0x43, 0x7a, 0x42, 0x45, 0x59, 0x6e, 0x77, 0x69, 0x48, 0x77, 0x30, 0x46, 0x5a, 0x79, 0x77, 0x71, 0x4f, 0x53, 0x46, 0x47, 0x43, 0x46, | 253 | 0x43, 0x7a, 0x42, 0x45, 0x59, 0x6e, 0x77, 0x69, 0x48, 0x77, 0x30, 0x46, 0x5a, 0x79, 0x77, |
232 | 0x42, 0x6d, 0x4e, 0x44, 0x63, 0x4c, 0x52, 0x55, 0x73, 0x34, 0x4d, 0x67, 0x5a, 0x36, 0x50, 0x6e, 0x38, 0x4d, 0x51, 0x42, 0x68, 0x72, | 254 | 0x71, 0x4f, 0x53, 0x46, 0x47, 0x43, 0x46, 0x42, 0x6d, 0x4e, 0x44, 0x63, 0x4c, 0x52, 0x55, |
233 | 0x4c, 0x57, 0x42, 0x4d, 0x59, 0x41, 0x77, 0x6a, 0x51, 0x7a, 0x73, 0x2b, 0x47, 0x78, 0x59, 0x45, 0x52, 0x6c, 0x67, 0x2f, 0x51, 0x47, | 255 | 0x73, 0x34, 0x4d, 0x67, 0x5a, 0x36, 0x50, 0x6e, 0x38, 0x4d, 0x51, 0x42, 0x68, 0x72, 0x4c, |
234 | 0x6f, 0x52, 0x42, 0x57, 0x4e, 0x78, 0x46, 0x44, 0x56, 0x48, 0x65, 0x52, 0x4e, 0x76, 0x61, 0x79, 0x63, 0x59, 0x57, 0x30, 0x67, 0x6e, | 256 | 0x57, 0x42, 0x4d, 0x59, 0x41, 0x77, 0x6a, 0x51, 0x7a, 0x73, 0x2b, 0x47, 0x78, 0x59, 0x45, |
235 | 0x50, 0x6d, 0x38, 0x56, 0x4d, 0x30, 0x38, 0x2b, 0x58, 0x6c, 0x46, 0x7a, 0x61, 0x43, 0x55, 0x50, 0x42, 0x6c, 0x74, 0x38, 0x63, 0x6e, | 257 | 0x52, 0x6c, 0x67, 0x2f, 0x51, 0x47, 0x6f, 0x52, 0x42, 0x57, 0x4e, 0x78, 0x46, 0x44, 0x56, |
236 | 0x55, 0x2b, 0x50, 0x78, 0x74, 0x63, 0x62, 0x57, 0x6f, 0x35, 0x66, 0x47, 0x4e, 0x6a, 0x59, 0x47, 0x78, 0x36, 0x4d, 0x33, 0x5a, 0x53, | 258 | 0x48, 0x65, 0x52, 0x4e, 0x76, 0x61, 0x79, 0x63, 0x59, 0x57, 0x30, 0x67, 0x6e, 0x50, 0x6d, |
237 | 0x45, 0x79, 0x55, 0x7a, 0x66, 0x57, 0x55, 0x6a, 0x4a, 0x78, 0x45, 0x47, 0x42, 0x6b, 0x64, 0x78, 0x48, 0x68, 0x52, 0x30, 0x59, 0x33, | 259 | 0x38, 0x56, 0x4d, 0x30, 0x38, 0x2b, 0x58, 0x6c, 0x46, 0x7a, 0x61, 0x43, 0x55, 0x50, 0x42, |
238 | 0x41, 0x74, 0x46, 0x53, 0x63, 0x59, 0x55, 0x51, 0x59, 0x46, 0x4d, 0x78, 0x45, 0x73, 0x61, 0x77, 0x41, 0x74, 0x64, 0x79, 0x42, 0x49, | 260 | 0x6c, 0x74, 0x38, 0x63, 0x6e, 0x55, 0x2b, 0x50, 0x78, 0x74, 0x63, 0x62, 0x57, 0x6f, 0x35, |
239 | 0x44, 0x58, 0x4e, 0x52, 0x52, 0x53, 0x56, 0x2f, 0x66, 0x7a, 0x55, 0x6d, 0x4c, 0x69, 0x5a, 0x54, 0x4a, 0x47, 0x67, 0x65, 0x44, 0x6c, | 261 | 0x66, 0x47, 0x4e, 0x6a, 0x59, 0x47, 0x78, 0x36, 0x4d, 0x33, 0x5a, 0x53, 0x45, 0x79, 0x55, |
240 | 0x67, 0x36, 0x57, 0x56, 0x42, 0x57, 0x4e, 0x31, 0x39, 0x6d, 0x41, 0x55, 0x78, 0x61, 0x5a, 0x44, 0x4a, 0x51, 0x65, 0x32, 0x6f, 0x67, | 262 | 0x7a, 0x66, 0x57, 0x55, 0x6a, 0x4a, 0x78, 0x45, 0x47, 0x42, 0x6b, 0x64, 0x78, 0x48, 0x68, |
241 | 0x63, 0x69, 0x73, 0x64, 0x66, 0x6b, 0x4e, 0x37, 0x59, 0x55, 0x49, 0x4c, 0x59, 0x58, 0x4d, 0x6b, 0x65, 0x54, 0x70, 0x72, 0x53, 0x6e, | 263 | 0x52, 0x30, 0x59, 0x33, 0x41, 0x74, 0x46, 0x53, 0x63, 0x59, 0x55, 0x51, 0x59, 0x46, 0x4d, |
242 | 0x6c, 0x75, 0x43, 0x51, 0x38, 0x6e, 0x4c, 0x51, 0x78, 0x65, 0x4d, 0x6b, 0x73, 0x4e, 0x65, 0x55, 0x59, 0x35, 0x49, 0x51, 0x6f, 0x6d, | 264 | 0x78, 0x45, 0x73, 0x61, 0x77, 0x41, 0x74, 0x64, 0x79, 0x42, 0x49, 0x44, 0x58, 0x4e, 0x52, |
243 | 0x58, 0x7a, 0x6f, 0x41, 0x4a, 0x6a, 0x38, 0x54, 0x4c, 0x6e, 0x35, 0x51, 0x4b, 0x32, 0x64, 0x47, 0x63, 0x6a, 0x38, 0x37, 0x41, 0x55, | 265 | 0x52, 0x53, 0x56, 0x2f, 0x66, 0x7a, 0x55, 0x6d, 0x4c, 0x69, 0x5a, 0x54, 0x4a, 0x47, 0x67, |
244 | 0x59, 0x62, 0x43, 0x7a, 0x56, 0x4a, 0x4f, 0x52, 0x6c, 0x77, 0x50, 0x51, 0x4a, 0x42, 0x44, 0x6a, 0x67, 0x46, 0x64, 0x6d, 0x56, 0x50, | 266 | 0x65, 0x44, 0x6c, 0x67, 0x36, 0x57, 0x56, 0x42, 0x57, 0x4e, 0x31, 0x39, 0x6d, 0x41, 0x55, |
245 | 0x4d, 0x57, 0x78, 0x65, 0x46, 0x77, 0x51, 0x56, 0x4e, 0x69, 0x5a, 0x6b, 0x4e, 0x42, 0x51, 0x58, 0x66, 0x41, 0x34, 0x4c, 0x57, 0x31, | 267 | 0x78, 0x61, 0x5a, 0x44, 0x4a, 0x51, 0x65, 0x32, 0x6f, 0x67, 0x63, 0x69, 0x73, 0x64, 0x66, |
246 | 0x56, 0x54, 0x61, 0x77, 0x42, 0x43, 0x51, 0x55, 0x38, 0x43, 0x58, 0x42, 0x4d, 0x4b, 0x4c, 0x43, 0x77, 0x2b, 0x45, 0x42, 0x51, 0x7a, | 268 | 0x6b, 0x4e, 0x37, 0x59, 0x55, 0x49, 0x4c, 0x59, 0x58, 0x4d, 0x6b, 0x65, 0x54, 0x70, 0x72, |
247 | 0x52, 0x58, 0x78, 0x36, 0x57, 0x6a, 0x46, 0x68, 0x4f, 0x51, 0x67, 0x69, 0x61, 0x68, 0x34, 0x50, 0x62, 0x78, 0x74, 0x73, 0x45, 0x31, | 269 | 0x53, 0x6e, 0x6c, 0x75, 0x43, 0x51, 0x38, 0x6e, 0x4c, 0x51, 0x78, 0x65, 0x4d, 0x6b, 0x73, |
248 | 0x35, 0x35, 0x49, 0x48, 0x6c, 0x51, 0x59, 0x67, 0x59, 0x73, 0x64, 0x68, 0x63, 0x45, 0x4b, 0x79, 0x70, 0x31, 0x48, 0x77, 0x77, 0x33, | 270 | 0x4e, 0x65, 0x55, 0x59, 0x35, 0x49, 0x51, 0x6f, 0x6d, 0x58, 0x7a, 0x6f, 0x41, 0x4a, 0x6a, |
249 | 0x54, 0x67, 0x39, 0x37, 0x4c, 0x54, 0x52, 0x31, 0x59, 0x44, 0x46, 0x30, 0x4c, 0x67, 0x70, 0x4b, 0x45, 0x57, 0x78, 0x4a, 0x4a, 0x51, | 271 | 0x38, 0x54, 0x4c, 0x6e, 0x35, 0x51, 0x4b, 0x32, 0x64, 0x47, 0x63, 0x6a, 0x38, 0x37, 0x41, |
250 | 0x45, 0x36, 0x50, 0x53, 0x49, 0x65, 0x62, 0x52, 0x68, 0x52, 0x65, 0x43, 0x31, 0x69, 0x4d, 0x55, 0x78, 0x51, 0x51, 0x42, 0x64, 0x4c, | 272 | 0x55, 0x59, 0x62, 0x43, 0x7a, 0x56, 0x4a, 0x4f, 0x52, 0x6c, 0x77, 0x50, 0x51, 0x4a, 0x42, |
251 | 0x62, 0x79, 0x49, 0x41, 0x66, 0x32, 0x45, 0x71, 0x4e, 0x44, 0x34, 0x41, 0x58, 0x79, 0x39, 0x66, 0x4c, 0x78, 0x51, 0x71, 0x56, 0x53, | 273 | 0x44, 0x6a, 0x67, 0x46, 0x64, 0x6d, 0x56, 0x50, 0x4d, 0x57, 0x78, 0x65, 0x46, 0x77, 0x51, |
252 | 0x63, 0x66, 0x52, 0x68, 0x38, 0x53, 0x52, 0x6c, 0x34, 0x65, 0x44, 0x48, 0x77, 0x34, 0x41, 0x57, 0x46, 0x6b, 0x64, 0x69, 0x4a, 0x75, | 274 | 0x56, 0x4e, 0x69, 0x5a, 0x6b, 0x4e, 0x42, 0x51, 0x58, 0x66, 0x41, 0x34, 0x4c, 0x57, 0x31, |
253 | 0x43, 0x43, 0x41, 0x34, 0x54, 0x33, 0x4e, 0x79, 0x56, 0x52, 0x4a, 0x43, 0x47, 0x56, 0x42, 0x68, 0x51, 0x33, 0x64, 0x39, 0x51, 0x53, | 275 | 0x56, 0x54, 0x61, 0x77, 0x42, 0x43, 0x51, 0x55, 0x38, 0x43, 0x58, 0x42, 0x4d, 0x4b, 0x4c, |
254 | 0x34, 0x31, 0x54, 0x7a, 0x30, 0x78, 0x4b, 0x46, 0x68, 0x6e, 0x47, 0x77, 0x4e, 0x52, 0x49, 0x44, 0x49, 0x63, 0x43, 0x47, 0x34, 0x33, | 276 | 0x43, 0x77, 0x2b, 0x45, 0x42, 0x51, 0x7a, 0x52, 0x58, 0x78, 0x36, 0x57, 0x6a, 0x46, 0x68, |
255 | 0x64, 0x54, 0x64, 0x45, 0x54, 0x32, 0x67, 0x5a, 0x42, 0x32, 0x51, 0x55, 0x4b, 0x43, 0x55, 0x72, 0x61, 0x54, 0x55, 0x59, 0x4a, 0x79, | 277 | 0x4f, 0x51, 0x67, 0x69, 0x61, 0x68, 0x34, 0x50, 0x62, 0x78, 0x74, 0x73, 0x45, 0x31, 0x35, |
256 | 0x59, 0x55, 0x45, 0x33, 0x42, 0x43, 0x47, 0x52, 0x4a, 0x31, 0x50, 0x67, 0x4a, 0x64, 0x66, 0x42, 0x4d, 0x66, 0x46, 0x6c, 0x4d, 0x37, | 278 | 0x35, 0x49, 0x48, 0x6c, 0x51, 0x59, 0x67, 0x59, 0x73, 0x64, 0x68, 0x63, 0x45, 0x4b, 0x79, |
257 | 0x64, 0x45, 0x67, 0x38, 0x58, 0x6a, 0x6c, 0x73, 0x48, 0x42, 0x78, 0x30, 0x4f, 0x52, 0x38, 0x41, 0x47, 0x77, 0x59, 0x4b, 0x61, 0x44, | 279 | 0x70, 0x31, 0x48, 0x77, 0x77, 0x33, 0x54, 0x67, 0x39, 0x37, 0x4c, 0x54, 0x52, 0x31, 0x59, |
258 | 0x74, 0x53, 0x54, 0x78, 0x35, 0x75, 0x50, 0x44, 0x55, 0x4d, 0x4f, 0x41, 0x34, 0x4c, 0x4f, 0x78, 0x70, 0x32, 0x49, 0x79, 0x6c, 0x54, | 280 | 0x44, 0x46, 0x30, 0x4c, 0x67, 0x70, 0x4b, 0x45, 0x57, 0x78, 0x4a, 0x4a, 0x51, 0x45, 0x36, |
259 | 0x48, 0x6c, 0x39, 0x42, 0x44, 0x45, 0x73, 0x4b, 0x5a, 0x53, 0x68, 0x34, 0x5a, 0x30, 0x68, 0x5a, 0x4a, 0x6d, 0x30, 0x78, 0x64, 0x69, | 281 | 0x50, 0x53, 0x49, 0x65, 0x62, 0x52, 0x68, 0x52, 0x65, 0x43, 0x31, 0x69, 0x4d, 0x55, 0x78, |
260 | 0x4e, 0x77, 0x59, 0x57, 0x51, 0x37, 0x4f, 0x48, 0x6c, 0x6d, 0x64, 0x46, 0x4d, 0x73, 0x5a, 0x47, 0x52, 0x55, 0x41, 0x31, 0x52, 0x6c, | 282 | 0x51, 0x51, 0x42, 0x64, 0x4c, 0x62, 0x79, 0x49, 0x41, 0x66, 0x32, 0x45, 0x71, 0x4e, 0x44, |
261 | 0x52, 0x45, 0x77, 0x59, 0x54, 0x30, 0x67, 0x67, 0x54, 0x33, 0x49, 0x51, 0x50, 0x77, 0x78, 0x53, 0x4c, 0x51, 0x4d, 0x55, 0x41, 0x31, | 283 | 0x34, 0x41, 0x58, 0x79, 0x39, 0x66, 0x4c, 0x78, 0x51, 0x71, 0x56, 0x53, 0x63, 0x66, 0x52, |
262 | 0x46, 0x43, 0x45, 0x48, 0x64, 0x71, 0x4e, 0x41, 0x59, 0x79, 0x41, 0x33, 0x49, 0x55, 0x66, 0x41, 0x68, 0x64, 0x55, 0x68, 0x70, 0x69, | 284 | 0x68, 0x38, 0x53, 0x52, 0x6c, 0x34, 0x65, 0x44, 0x48, 0x77, 0x34, 0x41, 0x57, 0x46, 0x6b, |
263 | 0x66, 0x44, 0x34, 0x77, 0x66, 0x6c, 0x39, 0x2f, 0x56, 0x41, 0x39, 0x45, 0x53, 0x56, 0x31, 0x65, 0x45, 0x47, 0x6f, 0x47, 0x4b, 0x77, | 285 | 0x64, 0x69, 0x4a, 0x75, 0x43, 0x43, 0x41, 0x34, 0x54, 0x33, 0x4e, 0x79, 0x56, 0x52, 0x4a, |
264 | 0x5a, 0x54, 0x45, 0x44, 0x6b, 0x33, 0x4d, 0x6b, 0x70, 0x4f, 0x50, 0x53, 0x74, 0x6c, 0x4f, 0x44, 0x6b, 0x48, 0x63, 0x6c, 0x52, 0x6b, | 286 | 0x43, 0x47, 0x56, 0x42, 0x68, 0x51, 0x33, 0x64, 0x39, 0x51, 0x53, 0x34, 0x31, 0x54, 0x7a, |
265 | 0x54, 0x56, 0x5a, 0x71, 0x41, 0x79, 0x4a, 0x77, 0x65, 0x31, 0x39, 0x67, 0x43, 0x79, 0x6f, 0x4c, 0x61, 0x78, 0x42, 0x6b, 0x46, 0x41, | 287 | 0x30, 0x78, 0x4b, 0x46, 0x68, 0x6e, 0x47, 0x77, 0x4e, 0x52, 0x49, 0x44, 0x49, 0x63, 0x43, |
266 | 0x55, 0x69, 0x41, 0x48, 0x4e, 0x41, 0x49, 0x31, 0x74, 0x52, 0x48, 0x79, 0x73, 0x61, 0x58, 0x57, 0x6c, 0x36, 0x52, 0x67, 0x78, 0x66, | 288 | 0x47, 0x34, 0x33, 0x64, 0x54, 0x64, 0x45, 0x54, 0x32, 0x67, 0x5a, 0x42, 0x32, 0x51, 0x55, |
267 | 0x4d, 0x6b, 0x74, 0x4b, 0x4b, 0x46, 0x4a, 0x35, 0x57, 0x78, 0x4a, 0x43, 0x47, 0x41, 0x42, 0x64, 0x4a, 0x7a, 0x46, 0x54, 0x50, 0x45, | 289 | 0x4b, 0x43, 0x55, 0x72, 0x61, 0x54, 0x55, 0x59, 0x4a, 0x79, 0x59, 0x55, 0x45, 0x33, 0x42, |
268 | 0x77, 0x32, 0x54, 0x6a, 0x67, 0x2f, 0x63, 0x67, 0x4e, 0x78, 0x41, 0x6c, 0x73, 0x32, 0x57, 0x58, 0x39, 0x31, 0x62, 0x67, 0x68, 0x55, | 290 | 0x43, 0x47, 0x52, 0x4a, 0x31, 0x50, 0x67, 0x4a, 0x64, 0x66, 0x42, 0x4d, 0x66, 0x46, 0x6c, |
269 | 0x44, 0x54, 0x51, 0x63, 0x4e, 0x46, 0x64, 0x64, 0x61, 0x55, 0x67, 0x41, 0x4f, 0x77, 0x55, 0x48, 0x62, 0x69, 0x64, 0x6c, 0x62, 0x6b, | 291 | 0x4d, 0x37, 0x64, 0x45, 0x67, 0x38, 0x58, 0x6a, 0x6c, 0x73, 0x48, 0x42, 0x78, 0x30, 0x4f, |
270 | 0x41, 0x39, 0x4f, 0x6b, 0x39, 0x79, 0x58, 0x54, 0x6b, 0x57, 0x44, 0x32, 0x4d, 0x53, 0x45, 0x68, 0x55, 0x36, 0x63, 0x41, 0x31, 0x58, | 292 | 0x52, 0x38, 0x41, 0x47, 0x77, 0x59, 0x4b, 0x61, 0x44, 0x74, 0x53, 0x54, 0x78, 0x35, 0x75, |
271 | 0x47, 0x41, 0x31, 0x65, 0x50, 0x53, 0x4a, 0x6f, 0x61, 0x48, 0x78, 0x74, 0x54, 0x77, 0x78, 0x37, 0x43, 0x53, 0x31, 0x4b, 0x63, 0x79, | 293 | 0x50, 0x44, 0x55, 0x4d, 0x4f, 0x41, 0x34, 0x4c, 0x4f, 0x78, 0x70, 0x32, 0x49, 0x79, 0x6c, |
272 | 0x42, 0x48, 0x42, 0x31, 0x64, 0x31, 0x58, 0x56, 0x4e, 0x77, 0x4e, 0x43, 0x46, 0x41, 0x56, 0x31, 0x46, 0x65, 0x53, 0x55, 0x51, 0x41, | 294 | 0x54, 0x48, 0x6c, 0x39, 0x42, 0x44, 0x45, 0x73, 0x4b, 0x5a, 0x53, 0x68, 0x34, 0x5a, 0x30, |
273 | 0x56, 0x43, 0x63, 0x45, 0x61, 0x48, 0x35, 0x5a, 0x56, 0x6c, 0x68, 0x30, 0x46, 0x44, 0x77, 0x57, 0x4d, 0x30, 0x45, 0x57, 0x53, 0x79, | 295 | 0x68, 0x5a, 0x4a, 0x6d, 0x30, 0x78, 0x64, 0x69, 0x4e, 0x77, 0x59, 0x57, 0x51, 0x37, 0x4f, |
274 | 0x39, 0x4a, 0x4e, 0x77, 0x70, 0x55, 0x43, 0x41, 0x67, 0x66, 0x4f, 0x57, 0x64, 0x32, 0x4b, 0x43, 0x67, 0x48, 0x48, 0x57, 0x46, 0x48, | 296 | 0x48, 0x6c, 0x6d, 0x64, 0x46, 0x4d, 0x73, 0x5a, 0x47, 0x52, 0x55, 0x41, 0x31, 0x52, 0x6c, |
275 | 0x55, 0x55, 0x31, 0x31, 0x4a, 0x6c, 0x4a, 0x48, 0x52, 0x77, 0x78, 0x58, 0x57, 0x48, 0x51, 0x2b, 0x59, 0x6d, 0x78, 0x59, 0x4f, 0x6b, | 297 | 0x52, 0x45, 0x77, 0x59, 0x54, 0x30, 0x67, 0x67, 0x54, 0x33, 0x49, 0x51, 0x50, 0x77, 0x78, |
276 | 0x51, 0x65, 0x46, 0x69, 0x34, 0x68, 0x48, 0x48, 0x4e, 0x46, 0x5a, 0x33, 0x52, 0x50, 0x4d, 0x32, 0x59, 0x4f, 0x64, 0x47, 0x59, 0x6d, | 298 | 0x53, 0x4c, 0x51, 0x4d, 0x55, 0x41, 0x31, 0x46, 0x43, 0x45, 0x48, 0x64, 0x71, 0x4e, 0x41, |
277 | 0x48, 0x79, 0x34, 0x34, 0x52, 0x45, 0x42, 0x2b, 0x4b, 0x6c, 0x42, 0x53, 0x58, 0x6b, 0x4d, 0x42, 0x65, 0x6a, 0x68, 0x4a, 0x50, 0x46, | 299 | 0x59, 0x79, 0x41, 0x33, 0x49, 0x55, 0x66, 0x41, 0x68, 0x64, 0x55, 0x68, 0x70, 0x69, 0x66, |
278 | 0x56, 0x4e, 0x57, 0x6b, 0x51, 0x49, 0x4a, 0x6c, 0x6c, 0x4e, 0x52, 0x51, 0x74, 0x49, 0x43, 0x6a, 0x4e, 0x65, 0x53, 0x6b, 0x31, 0x31, | 300 | 0x44, 0x34, 0x77, 0x66, 0x6c, 0x39, 0x2f, 0x56, 0x41, 0x39, 0x45, 0x53, 0x56, 0x31, 0x65, |
279 | 0x46, 0x68, 0x64, 0x6a, 0x52, 0x67, 0x45, 0x71, 0x56, 0x58, 0x73, 0x50, 0x41, 0x6e, 0x4e, 0x71, 0x53, 0x33, 0x39, 0x31, 0x5a, 0x54, | 301 | 0x45, 0x47, 0x6f, 0x47, 0x4b, 0x77, 0x5a, 0x54, 0x45, 0x44, 0x6b, 0x33, 0x4d, 0x6b, 0x70, |
280 | 0x78, 0x4d, 0x4d, 0x7a, 0x6c, 0x73, 0x64, 0x41, 0x56, 0x67, 0x44, 0x33, 0x38, 0x74, 0x51, 0x55, 0x31, 0x4e, 0x52, 0x6e, 0x45, 0x4a, | 302 | 0x4f, 0x50, 0x53, 0x74, 0x6c, 0x4f, 0x44, 0x6b, 0x48, 0x63, 0x6c, 0x52, 0x6b, 0x54, 0x56, |
281 | 0x62, 0x30, 0x39, 0x67, 0x46, 0x51, 0x39, 0x47, 0x63, 0x32, 0x4e, 0x4d, 0x58, 0x6e, 0x51, 0x77, 0x44, 0x53, 0x68, 0x44, 0x43, 0x48, | 303 | 0x5a, 0x71, 0x41, 0x79, 0x4a, 0x77, 0x65, 0x31, 0x39, 0x67, 0x43, 0x79, 0x6f, 0x4c, 0x61, |
282 | 0x49, 0x79, 0x42, 0x43, 0x34, 0x78, 0x4b, 0x53, 0x64, 0x45, 0x62, 0x52, 0x4d, 0x58, 0x53, 0x41, 0x39, 0x4a, 0x55, 0x68, 0x41, 0x54, | 304 | 0x78, 0x42, 0x6b, 0x46, 0x41, 0x55, 0x69, 0x41, 0x48, 0x4e, 0x41, 0x49, 0x31, 0x74, 0x52, |
283 | 0x66, 0x78, 0x63, 0x57, 0x59, 0x6e, 0x6b, 0x31, 0x65, 0x44, 0x34, 0x42, 0x66, 0x43, 0x34, 0x50, 0x64, 0x6a, 0x35, 0x65, 0x55, 0x32, | 305 | 0x48, 0x79, 0x73, 0x61, 0x58, 0x57, 0x6c, 0x36, 0x52, 0x67, 0x78, 0x66, 0x4d, 0x6b, 0x74, |
284 | 0x78, 0x62, 0x58, 0x33, 0x77, 0x5a, 0x51, 0x51, 0x49, 0x76, 0x46, 0x32, 0x52, 0x42, 0x64, 0x52, 0x41, 0x45, 0x52, 0x33, 0x77, 0x39, | 306 | 0x4b, 0x4b, 0x46, 0x4a, 0x35, 0x57, 0x78, 0x4a, 0x43, 0x47, 0x41, 0x42, 0x64, 0x4a, 0x7a, |
285 | 0x53, 0x31, 0x49, 0x41, 0x45, 0x46, 0x31, 0x52, 0x54, 0x6e, 0x6f, 0x6e, 0x4a, 0x56, 0x56, 0x41, 0x45, 0x6a, 0x56, 0x67, 0x42, 0x52, | 307 | 0x46, 0x54, 0x50, 0x45, 0x77, 0x32, 0x54, 0x6a, 0x67, 0x2f, 0x63, 0x67, 0x4e, 0x78, 0x41, |
286 | 0x73, 0x30, 0x4c, 0x51, 0x52, 0x36, 0x61, 0x6d, 0x6b, 0x43, 0x65, 0x51, 0x4d, 0x36, 0x4c, 0x77, 0x59, 0x4b, 0x65, 0x58, 0x73, 0x53, | 308 | 0x6c, 0x73, 0x32, 0x57, 0x58, 0x39, 0x31, 0x62, 0x67, 0x68, 0x55, 0x44, 0x54, 0x51, 0x63, |
287 | 0x58, 0x58, 0x78, 0x53, 0x4b, 0x55, 0x64, 0x59, 0x45, 0x6e, 0x4d, 0x2f, 0x4a, 0x31, 0x59, 0x46, 0x44, 0x45, 0x67, 0x79, 0x57, 0x47, | 309 | 0x4e, 0x46, 0x64, 0x64, 0x61, 0x55, 0x67, 0x41, 0x4f, 0x77, 0x55, 0x48, 0x62, 0x69, 0x64, |
288 | 0x74, 0x58, 0x58, 0x41, 0x4e, 0x6b, 0x56, 0x68, 0x46, 0x53, 0x65, 0x6a, 0x41, 0x32, 0x4b, 0x52, 0x63, 0x37, 0x61, 0x48, 0x70, 0x38, | 310 | 0x6c, 0x62, 0x6b, 0x41, 0x39, 0x4f, 0x6b, 0x39, 0x79, 0x58, 0x54, 0x6b, 0x57, 0x44, 0x32, |
289 | 0x42, 0x57, 0x74, 0x72, 0x45, 0x32, 0x6f, 0x6b, 0x58, 0x47, 0x68, 0x43, 0x47, 0x44, 0x49, 0x44, 0x63, 0x32, 0x34, 0x45, 0x49, 0x53, | 311 | 0x4d, 0x53, 0x45, 0x68, 0x55, 0x36, 0x63, 0x41, 0x31, 0x58, 0x47, 0x41, 0x31, 0x65, 0x50, |
290 | 0x34, 0x42, 0x42, 0x47, 0x4e, 0x39, 0x52, 0x45, 0x45, 0x53, 0x4d, 0x51, 0x73, 0x56, 0x48, 0x33, 0x41, 0x41, 0x4c, 0x6d, 0x59, 0x55, | 312 | 0x53, 0x4a, 0x6f, 0x61, 0x48, 0x78, 0x74, 0x54, 0x77, 0x78, 0x37, 0x43, 0x53, 0x31, 0x4b, |
291 | 0x50, 0x48, 0x38, 0x72, 0x41, 0x42, 0x38, 0x4d, 0x4b, 0x46, 0x6b, 0x4b, 0x46, 0x6b, 0x6c, 0x61, 0x58, 0x47, 0x52, 0x6c, 0x53, 0x78, | 313 | 0x63, 0x79, 0x42, 0x48, 0x42, 0x31, 0x64, 0x31, 0x58, 0x56, 0x4e, 0x77, 0x4e, 0x43, 0x46, |
292 | 0x45, 0x70, 0x46, 0x54, 0x5a, 0x61, 0x5a, 0x52, 0x6c, 0x50, 0x59, 0x43, 0x4d, 0x36, 0x4f, 0x68, 0x4d, 0x6c, 0x41, 0x6e, 0x68, 0x4d, | 314 | 0x41, 0x56, 0x31, 0x46, 0x65, 0x53, 0x55, 0x51, 0x41, 0x56, 0x43, 0x63, 0x45, 0x61, 0x48, |
293 | 0x56, 0x41, 0x3d, 0x3d, 0x00}; | 315 | 0x35, 0x5a, 0x56, 0x6c, 0x68, 0x30, 0x46, 0x44, 0x77, 0x57, 0x4d, 0x30, 0x45, 0x57, 0x53, |
316 | 0x79, 0x39, 0x4a, 0x4e, 0x77, 0x70, 0x55, 0x43, 0x41, 0x67, 0x66, 0x4f, 0x57, 0x64, 0x32, | ||
317 | 0x4b, 0x43, 0x67, 0x48, 0x48, 0x57, 0x46, 0x48, 0x55, 0x55, 0x31, 0x31, 0x4a, 0x6c, 0x4a, | ||
318 | 0x48, 0x52, 0x77, 0x78, 0x58, 0x57, 0x48, 0x51, 0x2b, 0x59, 0x6d, 0x78, 0x59, 0x4f, 0x6b, | ||
319 | 0x51, 0x65, 0x46, 0x69, 0x34, 0x68, 0x48, 0x48, 0x4e, 0x46, 0x5a, 0x33, 0x52, 0x50, 0x4d, | ||
320 | 0x32, 0x59, 0x4f, 0x64, 0x47, 0x59, 0x6d, 0x48, 0x79, 0x34, 0x34, 0x52, 0x45, 0x42, 0x2b, | ||
321 | 0x4b, 0x6c, 0x42, 0x53, 0x58, 0x6b, 0x4d, 0x42, 0x65, 0x6a, 0x68, 0x4a, 0x50, 0x46, 0x56, | ||
322 | 0x4e, 0x57, 0x6b, 0x51, 0x49, 0x4a, 0x6c, 0x6c, 0x4e, 0x52, 0x51, 0x74, 0x49, 0x43, 0x6a, | ||
323 | 0x4e, 0x65, 0x53, 0x6b, 0x31, 0x31, 0x46, 0x68, 0x64, 0x6a, 0x52, 0x67, 0x45, 0x71, 0x56, | ||
324 | 0x58, 0x73, 0x50, 0x41, 0x6e, 0x4e, 0x71, 0x53, 0x33, 0x39, 0x31, 0x5a, 0x54, 0x78, 0x4d, | ||
325 | 0x4d, 0x7a, 0x6c, 0x73, 0x64, 0x41, 0x56, 0x67, 0x44, 0x33, 0x38, 0x74, 0x51, 0x55, 0x31, | ||
326 | 0x4e, 0x52, 0x6e, 0x45, 0x4a, 0x62, 0x30, 0x39, 0x67, 0x46, 0x51, 0x39, 0x47, 0x63, 0x32, | ||
327 | 0x4e, 0x4d, 0x58, 0x6e, 0x51, 0x77, 0x44, 0x53, 0x68, 0x44, 0x43, 0x48, 0x49, 0x79, 0x42, | ||
328 | 0x43, 0x34, 0x78, 0x4b, 0x53, 0x64, 0x45, 0x62, 0x52, 0x4d, 0x58, 0x53, 0x41, 0x39, 0x4a, | ||
329 | 0x55, 0x68, 0x41, 0x54, 0x66, 0x78, 0x63, 0x57, 0x59, 0x6e, 0x6b, 0x31, 0x65, 0x44, 0x34, | ||
330 | 0x42, 0x66, 0x43, 0x34, 0x50, 0x64, 0x6a, 0x35, 0x65, 0x55, 0x32, 0x78, 0x62, 0x58, 0x33, | ||
331 | 0x77, 0x5a, 0x51, 0x51, 0x49, 0x76, 0x46, 0x32, 0x52, 0x42, 0x64, 0x52, 0x41, 0x45, 0x52, | ||
332 | 0x33, 0x77, 0x39, 0x53, 0x31, 0x49, 0x41, 0x45, 0x46, 0x31, 0x52, 0x54, 0x6e, 0x6f, 0x6e, | ||
333 | 0x4a, 0x56, 0x56, 0x41, 0x45, 0x6a, 0x56, 0x67, 0x42, 0x52, 0x73, 0x30, 0x4c, 0x51, 0x52, | ||
334 | 0x36, 0x61, 0x6d, 0x6b, 0x43, 0x65, 0x51, 0x4d, 0x36, 0x4c, 0x77, 0x59, 0x4b, 0x65, 0x58, | ||
335 | 0x73, 0x53, 0x58, 0x58, 0x78, 0x53, 0x4b, 0x55, 0x64, 0x59, 0x45, 0x6e, 0x4d, 0x2f, 0x4a, | ||
336 | 0x31, 0x59, 0x46, 0x44, 0x45, 0x67, 0x79, 0x57, 0x47, 0x74, 0x58, 0x58, 0x41, 0x4e, 0x6b, | ||
337 | 0x56, 0x68, 0x46, 0x53, 0x65, 0x6a, 0x41, 0x32, 0x4b, 0x52, 0x63, 0x37, 0x61, 0x48, 0x70, | ||
338 | 0x38, 0x42, 0x57, 0x74, 0x72, 0x45, 0x32, 0x6f, 0x6b, 0x58, 0x47, 0x68, 0x43, 0x47, 0x44, | ||
339 | 0x49, 0x44, 0x63, 0x32, 0x34, 0x45, 0x49, 0x53, 0x34, 0x42, 0x42, 0x47, 0x4e, 0x39, 0x52, | ||
340 | 0x45, 0x45, 0x53, 0x4d, 0x51, 0x73, 0x56, 0x48, 0x33, 0x41, 0x41, 0x4c, 0x6d, 0x59, 0x55, | ||
341 | 0x50, 0x48, 0x38, 0x72, 0x41, 0x42, 0x38, 0x4d, 0x4b, 0x46, 0x6b, 0x4b, 0x46, 0x6b, 0x6c, | ||
342 | 0x61, 0x58, 0x47, 0x52, 0x6c, 0x53, 0x78, 0x45, 0x70, 0x46, 0x54, 0x5a, 0x61, 0x5a, 0x52, | ||
343 | 0x6c, 0x50, 0x59, 0x43, 0x4d, 0x36, 0x4f, 0x68, 0x4d, 0x6c, 0x41, 0x6e, 0x68, 0x4d, 0x56, | ||
344 | 0x41, 0x3d, 0x3d, 0x00}; | ||
294 | char *b64_test; | 345 | char *b64_test; |
295 | 346 | ||
296 | plan_tests(1); | 347 | plan_tests(1); |
diff --git a/lib/tests/test_cmd.c b/lib/tests/test_cmd.c index c8867dfb..d51016cc 100644 --- a/lib/tests/test_cmd.c +++ b/lib/tests/test_cmd.c | |||
@@ -38,36 +38,35 @@ char *get_command(char *const *line) { | |||
38 | } | 38 | } |
39 | 39 | ||
40 | int main(int argc, char **argv) { | 40 | int main(int argc, char **argv) { |
41 | char **command_line = malloc(sizeof(char *) * COMMAND_LINE); | ||
42 | char *command = NULL; | ||
43 | char *perl; | ||
44 | output chld_out, chld_err; | ||
45 | int c; | ||
46 | int result = UNSET; | ||
47 | |||
48 | plan_tests(51); | 41 | plan_tests(51); |
49 | 42 | ||
50 | diag("Running plain echo command, set one"); | 43 | diag("Running plain echo command, set one"); |
51 | 44 | ||
52 | /* ensure everything is empty before we begin */ | 45 | /* ensure everything is empty before we begin */ |
46 | |||
47 | output chld_out; | ||
53 | memset(&chld_out, 0, sizeof(output)); | 48 | memset(&chld_out, 0, sizeof(output)); |
49 | output chld_err; | ||
54 | memset(&chld_err, 0, sizeof(output)); | 50 | memset(&chld_err, 0, sizeof(output)); |
55 | ok(chld_out.lines == 0, "(initialised) Checking stdout is reset"); | 51 | ok(chld_out.lines == 0, "(initialised) Checking stdout is reset"); |
56 | ok(chld_err.lines == 0, "(initialised) Checking stderr is reset"); | 52 | ok(chld_err.lines == 0, "(initialised) Checking stderr is reset"); |
53 | int result = UNSET; | ||
57 | ok(result == UNSET, "(initialised) Checking exit code is reset"); | 54 | ok(result == UNSET, "(initialised) Checking exit code is reset"); |
58 | 55 | ||
56 | char **command_line = malloc(sizeof(char *) * COMMAND_LINE); | ||
59 | command_line[0] = strdup("/bin/echo"); | 57 | command_line[0] = strdup("/bin/echo"); |
60 | command_line[1] = strdup("this"); | 58 | command_line[1] = strdup("this"); |
61 | command_line[2] = strdup("is"); | 59 | command_line[2] = strdup("is"); |
62 | command_line[3] = strdup("test"); | 60 | command_line[3] = strdup("test"); |
63 | command_line[4] = strdup("one"); | 61 | command_line[4] = strdup("one"); |
64 | 62 | ||
65 | command = get_command(command_line); | 63 | char *command = get_command(command_line); |
66 | 64 | ||
67 | result = cmd_run_array(command_line, &chld_out, &chld_err, 0); | 65 | result = cmd_run_array(command_line, &chld_out, &chld_err, 0); |
68 | ok(chld_out.lines == 1, "(array) Check for expected number of stdout lines"); | 66 | ok(chld_out.lines == 1, "(array) Check for expected number of stdout lines"); |
69 | ok(chld_err.lines == 0, "(array) Check for expected number of stderr lines"); | 67 | ok(chld_err.lines == 0, "(array) Check for expected number of stderr lines"); |
70 | ok(strcmp(chld_out.line[0], "this is test one") == 0, "(array) Check for expected stdout output"); | 68 | ok(strcmp(chld_out.line[0], "this is test one") == 0, |
69 | "(array) Check for expected stdout output"); | ||
71 | ok(result == 0, "(array) Checking exit code"); | 70 | ok(result == 0, "(array) Checking exit code"); |
72 | 71 | ||
73 | /* ensure everything is empty again */ | 72 | /* ensure everything is empty again */ |
@@ -82,7 +81,8 @@ int main(int argc, char **argv) { | |||
82 | 81 | ||
83 | ok(chld_out.lines == 1, "(string) Check for expected number of stdout lines"); | 82 | ok(chld_out.lines == 1, "(string) Check for expected number of stdout lines"); |
84 | ok(chld_err.lines == 0, "(string) Check for expected number of stderr lines"); | 83 | ok(chld_err.lines == 0, "(string) Check for expected number of stderr lines"); |
85 | ok(strcmp(chld_out.line[0], "this is test one") == 0, "(string) Check for expected stdout output"); | 84 | ok(strcmp(chld_out.line[0], "this is test one") == 0, |
85 | "(string) Check for expected stdout output"); | ||
86 | ok(result == 0, "(string) Checking exit code"); | 86 | ok(result == 0, "(string) Checking exit code"); |
87 | 87 | ||
88 | diag("Running plain echo command, set two"); | 88 | diag("Running plain echo command, set two"); |
@@ -104,7 +104,8 @@ int main(int argc, char **argv) { | |||
104 | result = cmd_run_array(command_line, &chld_out, &chld_err, 0); | 104 | result = cmd_run_array(command_line, &chld_out, &chld_err, 0); |
105 | ok(chld_out.lines == 1, "(array) Check for expected number of stdout lines"); | 105 | ok(chld_out.lines == 1, "(array) Check for expected number of stdout lines"); |
106 | ok(chld_err.lines == 0, "(array) Check for expected number of stderr lines"); | 106 | ok(chld_err.lines == 0, "(array) Check for expected number of stderr lines"); |
107 | ok(strcmp(chld_out.line[0], "this is test two") == 0, "(array) Check for expected stdout output"); | 107 | ok(strcmp(chld_out.line[0], "this is test two") == 0, |
108 | "(array) Check for expected stdout output"); | ||
108 | ok(result == 0, "(array) Checking exit code"); | 109 | ok(result == 0, "(array) Checking exit code"); |
109 | 110 | ||
110 | /* ensure everything is empty again */ | 111 | /* ensure everything is empty again */ |
@@ -119,7 +120,8 @@ int main(int argc, char **argv) { | |||
119 | 120 | ||
120 | ok(chld_out.lines == 1, "(string) Check for expected number of stdout lines"); | 121 | ok(chld_out.lines == 1, "(string) Check for expected number of stdout lines"); |
121 | ok(chld_err.lines == 0, "(string) Check for expected number of stderr lines"); | 122 | ok(chld_err.lines == 0, "(string) Check for expected number of stderr lines"); |
122 | ok(strcmp(chld_out.line[0], "this is test one") == 0, "(string) Check for expected stdout output"); | 123 | ok(strcmp(chld_out.line[0], "this is test one") == 0, |
124 | "(string) Check for expected stdout output"); | ||
123 | ok(result == 0, "(string) Checking exit code"); | 125 | ok(result == 0, "(string) Checking exit code"); |
124 | 126 | ||
125 | /* ensure everything is empty again */ | 127 | /* ensure everything is empty again */ |
@@ -130,7 +132,8 @@ int main(int argc, char **argv) { | |||
130 | ok(chld_err.lines == 0, "(initialised) Checking stderr is reset"); | 132 | ok(chld_err.lines == 0, "(initialised) Checking stderr is reset"); |
131 | ok(result == UNSET, "(initialised) Checking exit code is reset"); | 133 | ok(result == UNSET, "(initialised) Checking exit code is reset"); |
132 | 134 | ||
133 | /* Pass linefeeds via parameters through - those should be evaluated by echo to give multi line output */ | 135 | /* Pass linefeeds via parameters through - those should be evaluated by echo to give multi line |
136 | * output */ | ||
134 | command_line[0] = strdup("/bin/echo"); | 137 | command_line[0] = strdup("/bin/echo"); |
135 | command_line[1] = strdup("this is a test via echo\nline two\nit's line 3"); | 138 | command_line[1] = strdup("this is a test via echo\nline two\nit's line 3"); |
136 | command_line[2] = strdup("and (note space between '3' and 'and') $$ will not get evaluated"); | 139 | command_line[2] = strdup("and (note space between '3' and 'and') $$ will not get evaluated"); |
@@ -138,9 +141,12 @@ int main(int argc, char **argv) { | |||
138 | result = cmd_run_array(command_line, &chld_out, &chld_err, 0); | 141 | result = cmd_run_array(command_line, &chld_out, &chld_err, 0); |
139 | ok(chld_out.lines == 3, "(array) Check for expected number of stdout lines"); | 142 | ok(chld_out.lines == 3, "(array) Check for expected number of stdout lines"); |
140 | ok(chld_err.lines == 0, "(array) Check for expected number of stderr lines"); | 143 | ok(chld_err.lines == 0, "(array) Check for expected number of stderr lines"); |
141 | ok(strcmp(chld_out.line[0], "this is a test via echo") == 0, "(array) Check line 1 for expected stdout output"); | 144 | ok(strcmp(chld_out.line[0], "this is a test via echo") == 0, |
142 | ok(strcmp(chld_out.line[1], "line two") == 0, "(array) Check line 2 for expected stdout output"); | 145 | "(array) Check line 1 for expected stdout output"); |
143 | ok(strcmp(chld_out.line[2], "it's line 3 and (note space between '3' and 'and') $$ will not get evaluated") == 0, | 146 | ok(strcmp(chld_out.line[1], "line two") == 0, |
147 | "(array) Check line 2 for expected stdout output"); | ||
148 | ok(strcmp(chld_out.line[2], | ||
149 | "it's line 3 and (note space between '3' and 'and') $$ will not get evaluated") == 0, | ||
144 | "(array) Check line 3 for expected stdout output"); | 150 | "(array) Check line 3 for expected stdout output"); |
145 | ok(result == 0, "(array) Checking exit code"); | 151 | ok(result == 0, "(array) Checking exit code"); |
146 | 152 | ||
@@ -171,7 +177,8 @@ int main(int argc, char **argv) { | |||
171 | 177 | ||
172 | ok(chld_out.lines == 0, "/bin/sh returns no stdout when file is missing..."); | 178 | ok(chld_out.lines == 0, "/bin/sh returns no stdout when file is missing..."); |
173 | ok(chld_err.lines == 1, "...but does give an error line"); | 179 | ok(chld_err.lines == 1, "...but does give an error line"); |
174 | ok(strstr(chld_err.line[0], "non-existent-file") != NULL, "And missing filename is in error message"); | 180 | ok(strstr(chld_err.line[0], "non-existent-file") != NULL, |
181 | "And missing filename is in error message"); | ||
175 | ok(result != 0, "Get non-zero return code from /bin/sh"); | 182 | ok(result != 0, "Get non-zero return code from /bin/sh"); |
176 | 183 | ||
177 | /* ensure everything is empty again */ | 184 | /* ensure everything is empty again */ |
diff --git a/lib/tests/test_generic_output.c b/lib/tests/test_generic_output.c index e67aefc9..e4a78bcd 100644 --- a/lib/tests/test_generic_output.c +++ b/lib/tests/test_generic_output.c | |||
@@ -110,7 +110,8 @@ void test_two_subchecks(void) { | |||
110 | sc1.output = "foobar"; | 110 | sc1.output = "foobar"; |
111 | sc1 = mp_set_subcheck_state(sc1, STATE_WARNING); | 111 | sc1 = mp_set_subcheck_state(sc1, STATE_WARNING); |
112 | 112 | ||
113 | ok(mp_compute_subcheck_state(sc1) == STATE_WARNING, "Test subcheck state directly after setting it"); | 113 | ok(mp_compute_subcheck_state(sc1) == STATE_WARNING, |
114 | "Test subcheck state directly after setting it"); | ||
114 | 115 | ||
115 | mp_perfdata pd1 = perfdata_init(); | 116 | mp_perfdata pd1 = perfdata_init(); |
116 | 117 | ||
@@ -129,7 +130,8 @@ void test_two_subchecks(void) { | |||
129 | 130 | ||
130 | mp_add_subcheck_to_subcheck(&sc1, sc2); | 131 | mp_add_subcheck_to_subcheck(&sc1, sc2); |
131 | 132 | ||
132 | ok(mp_compute_subcheck_state(sc1) == STATE_WARNING, "Test subcheck state after adding a subcheck"); | 133 | ok(mp_compute_subcheck_state(sc1) == STATE_WARNING, |
134 | "Test subcheck state after adding a subcheck"); | ||
133 | 135 | ||
134 | mp_check check = mp_check_init(); | 136 | mp_check check = mp_check_init(); |
135 | mp_add_subcheck_to_check(&check, sc1); | 137 | mp_add_subcheck_to_check(&check, sc1); |
diff --git a/lib/tests/test_ini1.c b/lib/tests/test_ini1.c index 246c1250..de983764 100644 --- a/lib/tests/test_ini1.c +++ b/lib/tests/test_ini1.c | |||
@@ -42,27 +42,30 @@ char *list2str(np_arg_list *optlst) { | |||
42 | free(optltmp); | 42 | free(optltmp); |
43 | } | 43 | } |
44 | /* Strip last whitespace */ | 44 | /* Strip last whitespace */ |
45 | if (strlen(optstr) > 1) | 45 | if (strlen(optstr) > 1) { |
46 | optstr[strlen(optstr) - 1] = '\0'; | 46 | optstr[strlen(optstr) - 1] = '\0'; |
47 | } | ||
47 | 48 | ||
48 | return optstr; | 49 | return optstr; |
49 | } | 50 | } |
50 | 51 | ||
51 | int main(int argc, char **argv) { | 52 | int main(int argc, char **argv) { |
52 | char *optstr = NULL; | ||
53 | 53 | ||
54 | plan_tests(12); | 54 | plan_tests(12); |
55 | 55 | ||
56 | optstr = list2str(np_get_defaults("section@./config-tiny.ini", "check_disk")); | 56 | char *optstr = list2str(np_get_defaults("section@./config-tiny.ini", "check_disk")); |
57 | ok(!strcmp(optstr, "--one=two --Foo=Bar --this=Your Mother! --blank"), "config-tiny.ini's section as expected"); | 57 | ok(!strcmp(optstr, "--one=two --Foo=Bar --this=Your Mother! --blank"), |
58 | "config-tiny.ini's section as expected"); | ||
58 | my_free(optstr); | 59 | my_free(optstr); |
59 | 60 | ||
60 | optstr = list2str(np_get_defaults("@./config-tiny.ini", "section")); | 61 | optstr = list2str(np_get_defaults("@./config-tiny.ini", "section")); |
61 | ok(!strcmp(optstr, "--one=two --Foo=Bar --this=Your Mother! --blank"), "Used default section name, without specific"); | 62 | ok(!strcmp(optstr, "--one=two --Foo=Bar --this=Your Mother! --blank"), |
63 | "Used default section name, without specific"); | ||
62 | my_free(optstr); | 64 | my_free(optstr); |
63 | 65 | ||
64 | optstr = list2str(np_get_defaults("Section Two@./config-tiny.ini", "check_disk")); | 66 | optstr = list2str(np_get_defaults("Section Two@./config-tiny.ini", "check_disk")); |
65 | ok(!strcmp(optstr, "--something else=blah --remove=whitespace"), "config-tiny.ini's Section Two as expected"); | 67 | ok(!strcmp(optstr, "--something else=blah --remove=whitespace"), |
68 | "config-tiny.ini's Section Two as expected"); | ||
66 | my_free(optstr); | 69 | my_free(optstr); |
67 | 70 | ||
68 | optstr = list2str(np_get_defaults("/path/to/file.txt@./config-tiny.ini", "check_disk")); | 71 | optstr = list2str(np_get_defaults("/path/to/file.txt@./config-tiny.ini", "check_disk")); |
@@ -70,15 +73,18 @@ int main(int argc, char **argv) { | |||
70 | my_free(optstr); | 73 | my_free(optstr); |
71 | 74 | ||
72 | optstr = list2str(np_get_defaults("section2@./config-tiny.ini", "check_disk")); | 75 | optstr = list2str(np_get_defaults("section2@./config-tiny.ini", "check_disk")); |
73 | ok(!strcmp(optstr, "--this=that"), "config-tiny.ini's section2 with whitespace before section name"); | 76 | ok(!strcmp(optstr, "--this=that"), |
77 | "config-tiny.ini's section2 with whitespace before section name"); | ||
74 | my_free(optstr); | 78 | my_free(optstr); |
75 | 79 | ||
76 | optstr = list2str(np_get_defaults("section3@./config-tiny.ini", "check_disk")); | 80 | optstr = list2str(np_get_defaults("section3@./config-tiny.ini", "check_disk")); |
77 | ok(!strcmp(optstr, "--this=that"), "config-tiny.ini's section3 with whitespace after section name"); | 81 | ok(!strcmp(optstr, "--this=that"), |
82 | "config-tiny.ini's section3 with whitespace after section name"); | ||
78 | my_free(optstr); | 83 | my_free(optstr); |
79 | 84 | ||
80 | optstr = list2str(np_get_defaults("check_mysql@./plugin.ini", "check_disk")); | 85 | optstr = list2str(np_get_defaults("check_mysql@./plugin.ini", "check_disk")); |
81 | ok(!strcmp(optstr, "--username=operator --password=secret"), "plugin.ini's check_mysql as expected"); | 86 | ok(!strcmp(optstr, "--username=operator --password=secret"), |
87 | "plugin.ini's check_mysql as expected"); | ||
82 | my_free(optstr); | 88 | my_free(optstr); |
83 | 89 | ||
84 | optstr = list2str(np_get_defaults("check_mysql2@./plugin.ini", "check_disk")); | 90 | optstr = list2str(np_get_defaults("check_mysql2@./plugin.ini", "check_disk")); |
@@ -90,29 +96,39 @@ int main(int argc, char **argv) { | |||
90 | my_free(optstr); | 96 | my_free(optstr); |
91 | 97 | ||
92 | optstr = list2str(np_get_defaults("Section Two@./config-dos.ini", "check_disk")); | 98 | optstr = list2str(np_get_defaults("Section Two@./config-dos.ini", "check_disk")); |
93 | ok(!strcmp(optstr, "--something else=blah --remove=whitespace"), "config-dos.ini's Section Two as expected"); | 99 | ok(!strcmp(optstr, "--something else=blah --remove=whitespace"), |
100 | "config-dos.ini's Section Two as expected"); | ||
94 | my_free(optstr); | 101 | my_free(optstr); |
95 | 102 | ||
96 | optstr = list2str(np_get_defaults("section_twice@./plugin.ini", "check_disk")); | 103 | optstr = list2str(np_get_defaults("section_twice@./plugin.ini", "check_disk")); |
97 | ok(!strcmp(optstr, "--foo=bar --bar=foo"), "plugin.ini's section_twice defined twice in the file"); | 104 | ok(!strcmp(optstr, "--foo=bar --bar=foo"), |
105 | "plugin.ini's section_twice defined twice in the file"); | ||
98 | my_free(optstr); | 106 | my_free(optstr); |
99 | 107 | ||
100 | optstr = list2str(np_get_defaults("tcp_long_lines@plugins.ini", "check_tcp")); | 108 | optstr = list2str(np_get_defaults("tcp_long_lines@plugins.ini", "check_tcp")); |
101 | ok(!strcmp(optstr, "--escape --send=Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar " | 109 | ok(!strcmp(optstr, "--escape --send=Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " |
110 | "yadda Foo bar BAZ yadda yadda yadda Foo bar " | ||
102 | "BAZ yadda yadda yadda Foo bar BAZ yadda yadda " | 111 | "BAZ yadda yadda yadda Foo bar BAZ yadda yadda " |
103 | "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " | 112 | "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar " |
113 | "BAZ yadda yadda yadda Foo bar BAZ yadda " | ||
104 | "yadda yadda Foo bar BAZ yadda yadda yadda Foo " | 114 | "yadda yadda Foo bar BAZ yadda yadda yadda Foo " |
105 | "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " | 115 | "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " |
116 | "yadda yadda Foo bar BAZ yadda yadda " | ||
106 | "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " | 117 | "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " |
107 | "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda --expect=Foo bar BAZ yadda yadda " | 118 | "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " |
119 | "yadda --expect=Foo bar BAZ yadda yadda " | ||
108 | "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " | 120 | "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " |
109 | "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo " | 121 | "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " |
122 | "yadda Foo bar BAZ yadda yadda yadda Foo " | ||
110 | "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " | 123 | "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " |
111 | "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " | 124 | "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar " |
125 | "BAZ yadda yadda yadda Foo bar BAZ yadda " | ||
112 | "yadda yadda Foo bar BAZ yadda yadda yadda Foo " | 126 | "yadda yadda Foo bar BAZ yadda yadda yadda Foo " |
113 | "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " | 127 | "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " |
128 | "yadda yadda Foo bar BAZ yadda yadda " | ||
114 | "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " | 129 | "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " |
115 | "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo " | 130 | "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " |
131 | "yadda Foo bar BAZ yadda yadda yadda Foo " | ||
116 | "bar BAZ yadda yadda yadda --jail"), | 132 | "bar BAZ yadda yadda yadda --jail"), |
117 | "Long options"); | 133 | "Long options"); |
118 | my_free(optstr); | 134 | my_free(optstr); |
diff --git a/lib/tests/test_opts1.c b/lib/tests/test_opts1.c index 984183d3..fa95c4d4 100644 --- a/lib/tests/test_opts1.c +++ b/lib/tests/test_opts1.c | |||
@@ -40,37 +40,40 @@ void my_free(int *argc, char **newargv, char **argv) { | |||
40 | #else | 40 | #else |
41 | void my_free(int *argc, char **newargv, char **argv) { | 41 | void my_free(int *argc, char **newargv, char **argv) { |
42 | /* Free stuff (and print while we're at it) */ | 42 | /* Free stuff (and print while we're at it) */ |
43 | int i, freeflag = 1; | 43 | bool freeflag = true; |
44 | printf(" Arg(%i): ", *argc + 1); | 44 | printf(" Arg(%i): ", *argc + 1); |
45 | printf("'%s' ", newargv[0]); | 45 | printf("'%s' ", newargv[0]); |
46 | for (i = 1; i < *argc; i++) { | 46 | |
47 | for (int i = 1; i < *argc; i++) { | ||
47 | printf("'%s' ", newargv[i]); | 48 | printf("'%s' ", newargv[i]); |
48 | /* Stop freeing when we get to the start of the original array */ | 49 | /* Stop freeing when we get to the start of the original array */ |
49 | if (freeflag) { | 50 | if (freeflag) { |
50 | if (newargv[i] == argv[1]) | 51 | if (newargv[i] == argv[1]) { |
51 | freeflag = 0; | 52 | freeflag = false; |
52 | else | 53 | } else { |
53 | free(newargv[i]); | 54 | free(newargv[i]); |
55 | } | ||
54 | } | 56 | } |
55 | } | 57 | } |
56 | printf("\n"); | 58 | printf("\n"); |
57 | /* Free only if it's a different array */ | 59 | /* Free only if it's a different array */ |
58 | if (newargv != argv) | 60 | if (newargv != argv) { |
59 | free(newargv); | 61 | free(newargv); |
62 | } | ||
60 | *argc = 0; | 63 | *argc = 0; |
61 | } | 64 | } |
62 | #endif | 65 | #endif |
63 | 66 | ||
64 | int array_diff(int i1, char **a1, int i2, char **a2) { | 67 | int array_diff(int i1, char **a1, int i2, char **a2) { |
65 | int i; | ||
66 | |||
67 | if (i1 != i2) { | 68 | if (i1 != i2) { |
68 | printf(" Argument count doesn't match!\n"); | 69 | printf(" Argument count doesn't match!\n"); |
69 | return 0; | 70 | return 0; |
70 | } | 71 | } |
71 | for (i = 0; i <= i1; i++) { | 72 | |
72 | if (a1[i] == NULL && a2[i] == NULL) | 73 | for (int i = 0; i <= i1; i++) { |
74 | if (a1[i] == NULL && a2[i] == NULL) { | ||
73 | continue; | 75 | continue; |
76 | } | ||
74 | if (a1[i] == NULL || a2[i] == NULL) { | 77 | if (a1[i] == NULL || a2[i] == NULL) { |
75 | printf(" Argument # %i null in one array!\n", i); | 78 | printf(" Argument # %i null in one array!\n", i); |
76 | return 0; | 79 | return 0; |
@@ -84,11 +87,10 @@ int array_diff(int i1, char **a1, int i2, char **a2) { | |||
84 | } | 87 | } |
85 | 88 | ||
86 | int main(int argc, char **argv) { | 89 | int main(int argc, char **argv) { |
87 | char **argv_new = NULL; | ||
88 | int i, argc_test; | ||
89 | |||
90 | plan_tests(5); | 90 | plan_tests(5); |
91 | 91 | ||
92 | char **argv_new = NULL; | ||
93 | int argc_test; | ||
92 | { | 94 | { |
93 | char *argv_test[] = {"prog_name", (char *)NULL}; | 95 | char *argv_test[] = {"prog_name", (char *)NULL}; |
94 | argc_test = 1; | 96 | argc_test = 1; |
@@ -110,27 +112,36 @@ int main(int argc, char **argv) { | |||
110 | { | 112 | { |
111 | char *argv_test[] = {"prog_name", "--extra-opts=@./config-opts.ini", (char *)NULL}; | 113 | char *argv_test[] = {"prog_name", "--extra-opts=@./config-opts.ini", (char *)NULL}; |
112 | argc_test = 2; | 114 | argc_test = 2; |
113 | char *argv_known[] = {"prog_name", "--foo=Bar", "--this=Your Mother!", "--blank", (char *)NULL}; | 115 | char *argv_known[] = {"prog_name", "--foo=Bar", "--this=Your Mother!", "--blank", |
116 | (char *)NULL}; | ||
114 | argv_new = np_extra_opts(&argc_test, argv_test, "check_disk"); | 117 | argv_new = np_extra_opts(&argc_test, argv_test, "check_disk"); |
115 | ok(array_diff(argc_test, argv_new, 4, argv_known), "Only extra opts using default section"); | 118 | ok(array_diff(argc_test, argv_new, 4, argv_known), "Only extra opts using default section"); |
116 | my_free(&argc_test, argv_new, argv_test); | 119 | my_free(&argc_test, argv_new, argv_test); |
117 | } | 120 | } |
118 | 121 | ||
119 | { | 122 | { |
120 | char *argv_test[] = {"prog_name", "--extra-opts=sect1@./config-opts.ini", "--extra-opts", "sect2@./config-opts.ini", (char *)NULL}; | 123 | char *argv_test[] = {"prog_name", "--extra-opts=sect1@./config-opts.ini", "--extra-opts", |
124 | "sect2@./config-opts.ini", (char *)NULL}; | ||
121 | argc_test = 4; | 125 | argc_test = 4; |
122 | char *argv_known[] = {"prog_name", "--one=two", "--something else=oops", "--this=that", (char *)NULL}; | 126 | char *argv_known[] = {"prog_name", "--one=two", "--something else=oops", "--this=that", |
127 | (char *)NULL}; | ||
123 | argv_new = np_extra_opts(&argc_test, argv_test, "check_disk"); | 128 | argv_new = np_extra_opts(&argc_test, argv_test, "check_disk"); |
124 | ok(array_diff(argc_test, argv_new, 4, argv_known), "Only extra opts specified twice"); | 129 | ok(array_diff(argc_test, argv_new, 4, argv_known), "Only extra opts specified twice"); |
125 | my_free(&argc_test, argv_new, argv_test); | 130 | my_free(&argc_test, argv_new, argv_test); |
126 | } | 131 | } |
127 | 132 | ||
128 | { | 133 | { |
129 | char *argv_test[] = {"prog_name", "--arg1=val1", "--extra-opts=@./config-opts.ini", "--extra-opts", "sect1@./config-opts.ini", | 134 | char *argv_test[] = {"prog_name", |
130 | "--arg2", (char *)NULL}; | 135 | "--arg1=val1", |
136 | "--extra-opts=@./config-opts.ini", | ||
137 | "--extra-opts", | ||
138 | "sect1@./config-opts.ini", | ||
139 | "--arg2", | ||
140 | (char *)NULL}; | ||
131 | argc_test = 6; | 141 | argc_test = 6; |
132 | char *argv_known[] = {"prog_name", "--foo=Bar", "--this=Your Mother!", "--blank", "--one=two", | 142 | char *argv_known[] = {"prog_name", "--foo=Bar", "--this=Your Mother!", |
133 | "--arg1=val1", "--arg2", (char *)NULL}; | 143 | "--blank", "--one=two", "--arg1=val1", |
144 | "--arg2", (char *)NULL}; | ||
134 | argv_new = np_extra_opts(&argc_test, argv_test, "check_disk"); | 145 | argv_new = np_extra_opts(&argc_test, argv_test, "check_disk"); |
135 | ok(array_diff(argc_test, argv_new, 7, argv_known), "twice extra opts using two sections"); | 146 | ok(array_diff(argc_test, argv_new, 7, argv_known), "twice extra opts using two sections"); |
136 | my_free(&argc_test, argv_new, argv_test); | 147 | my_free(&argc_test, argv_new, argv_test); |
diff --git a/lib/tests/test_opts2.c b/lib/tests/test_opts2.c index 23496617..3dd1b039 100644 --- a/lib/tests/test_opts2.c +++ b/lib/tests/test_opts2.c | |||
@@ -23,36 +23,39 @@ | |||
23 | 23 | ||
24 | void my_free(int *argc, char **newargv, char **argv) { | 24 | void my_free(int *argc, char **newargv, char **argv) { |
25 | /* Free stuff (and print while we're at it) */ | 25 | /* Free stuff (and print while we're at it) */ |
26 | int i, freeflag = 1; | 26 | bool freeflag = true; |
27 | |||
27 | printf(" Arg(%i): ", *argc + 1); | 28 | printf(" Arg(%i): ", *argc + 1); |
28 | printf("'%s' ", newargv[0]); | 29 | printf("'%s' ", newargv[0]); |
29 | for (i = 1; i < *argc; i++) { | 30 | for (int i = 1; i < *argc; i++) { |
30 | printf("'%s' ", newargv[i]); | 31 | printf("'%s' ", newargv[i]); |
31 | /* Stop freeing when we get to the start of the original array */ | 32 | /* Stop freeing when we get to the start of the original array */ |
32 | if (freeflag) { | 33 | if (freeflag) { |
33 | if (newargv[i] == argv[1]) | 34 | if (newargv[i] == argv[1]) { |
34 | freeflag = 0; | 35 | freeflag = false; |
35 | else | 36 | } else { |
36 | free(newargv[i]); | 37 | free(newargv[i]); |
38 | } | ||
37 | } | 39 | } |
38 | } | 40 | } |
39 | printf("\n"); | 41 | printf("\n"); |
40 | /* Free only if it's a different array */ | 42 | /* Free only if it's a different array */ |
41 | if (newargv != argv) | 43 | if (newargv != argv) { |
42 | free(newargv); | 44 | free(newargv); |
45 | } | ||
43 | *argc = 0; | 46 | *argc = 0; |
44 | } | 47 | } |
45 | 48 | ||
46 | int array_diff(int i1, char **a1, int i2, char **a2) { | 49 | int array_diff(int i1, char **a1, int i2, char **a2) { |
47 | int i; | ||
48 | |||
49 | if (i1 != i2) { | 50 | if (i1 != i2) { |
50 | printf(" Argument count doesn't match!\n"); | 51 | printf(" Argument count doesn't match!\n"); |
51 | return 0; | 52 | return 0; |
52 | } | 53 | } |
53 | for (i = 0; i <= i1; i++) { | 54 | |
54 | if (a1[i] == NULL && a2[i] == NULL) | 55 | for (int i = 0; i <= i1; i++) { |
56 | if (a1[i] == NULL && a2[i] == NULL) { | ||
55 | continue; | 57 | continue; |
58 | } | ||
56 | if (a1[i] == NULL || a2[i] == NULL) { | 59 | if (a1[i] == NULL || a2[i] == NULL) { |
57 | printf(" Argument # %i null in one array!\n", i); | 60 | printf(" Argument # %i null in one array!\n", i); |
58 | return 0; | 61 | return 0; |
@@ -66,11 +69,10 @@ int array_diff(int i1, char **a1, int i2, char **a2) { | |||
66 | } | 69 | } |
67 | 70 | ||
68 | int main(int argc, char **argv) { | 71 | int main(int argc, char **argv) { |
69 | char **argv_new = NULL; | ||
70 | int i, argc_test; | ||
71 | |||
72 | plan_tests(5); | 72 | plan_tests(5); |
73 | 73 | ||
74 | char **argv_new = NULL; | ||
75 | int argc_test; | ||
74 | { | 76 | { |
75 | char *argv_test[] = {"prog_name", "arg1", "--extra-opts", "--arg3", "val2", (char *)NULL}; | 77 | char *argv_test[] = {"prog_name", "arg1", "--extra-opts", "--arg3", "val2", (char *)NULL}; |
76 | argc_test = 5; | 78 | argc_test = 5; |
@@ -90,7 +92,8 @@ int main(int argc, char **argv) { | |||
90 | } | 92 | } |
91 | 93 | ||
92 | { | 94 | { |
93 | char *argv_test[] = {"prog_name", "arg1", "--extra-opts=section1", "--arg3", "val2", (char *)NULL}; | 95 | char *argv_test[] = {"prog_name", "arg1", "--extra-opts=section1", |
96 | "--arg3", "val2", (char *)NULL}; | ||
94 | argc_test = 5; | 97 | argc_test = 5; |
95 | char *argv_known[] = {"prog_name", "--foobar=baz", "arg1", "--arg3", "val2", (char *)NULL}; | 98 | char *argv_known[] = {"prog_name", "--foobar=baz", "arg1", "--arg3", "val2", (char *)NULL}; |
96 | argv_new = np_extra_opts(&argc_test, argv_test, "check_disk"); | 99 | argv_new = np_extra_opts(&argc_test, argv_test, "check_disk"); |
@@ -108,30 +111,39 @@ int main(int argc, char **argv) { | |||
108 | } | 111 | } |
109 | 112 | ||
110 | { | 113 | { |
111 | char *argv_test[] = {"check_tcp", "--extra-opts", "--extra-opts=tcp_long_lines", (char *)NULL}; | 114 | char *argv_test[] = {"check_tcp", "--extra-opts", "--extra-opts=tcp_long_lines", |
115 | (char *)NULL}; | ||
112 | argc_test = 3; | 116 | argc_test = 3; |
113 | char *argv_known[] = { | 117 | char *argv_known[] = {"check_tcp", |
114 | "check_tcp", | 118 | "--timeout=10", |
115 | "--timeout=10", | 119 | "--escape", |
116 | "--escape", | 120 | "--send=Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda " |
117 | "--send=Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " | 121 | "Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " |
118 | "yadda Foo bar BAZ yadda " | 122 | "yadda Foo bar BAZ yadda " |
119 | "yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " | 123 | "yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " |
120 | "yadda Foo bar BAZ " | 124 | "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " |
121 | "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " | 125 | "yadda Foo bar BAZ " |
122 | "yadda yadda Foo bar " | 126 | "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " |
123 | "BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda", | 127 | "yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " |
124 | "--expect=Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " | 128 | "yadda yadda Foo bar " |
125 | "yadda Foo bar BAZ yadda " | 129 | "BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " |
126 | "yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " | 130 | "yadda yadda yadda Foo bar BAZ yadda yadda yadda", |
127 | "yadda Foo bar BAZ " | 131 | "--expect=Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " |
128 | "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " | 132 | "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " |
129 | "yadda yadda Foo bar " | 133 | "yadda Foo bar BAZ yadda " |
130 | "BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " | 134 | "yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " |
131 | "yadda yadda yadda Foo " | 135 | "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " |
132 | "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda", | 136 | "yadda Foo bar BAZ " |
133 | "--jail", | 137 | "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " |
134 | (char *)NULL}; | 138 | "yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " |
139 | "yadda yadda Foo bar " | ||
140 | "BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " | ||
141 | "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " | ||
142 | "yadda yadda yadda Foo " | ||
143 | "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " | ||
144 | "yadda yadda yadda Foo bar BAZ yadda yadda yadda", | ||
145 | "--jail", | ||
146 | (char *)NULL}; | ||
135 | argv_new = np_extra_opts(&argc_test, argv_test, "check_tcp"); | 147 | argv_new = np_extra_opts(&argc_test, argv_test, "check_tcp"); |
136 | ok(array_diff(argc_test, argv_new, 6, argv_known), "Long lines test"); | 148 | ok(array_diff(argc_test, argv_new, 6, argv_known), "Long lines test"); |
137 | my_free(&argc_test, argv_new, argv_test); | 149 | my_free(&argc_test, argv_new, argv_test); |
diff --git a/lib/tests/test_tcp.c b/lib/tests/test_tcp.c index 1b3003e9..37c818c9 100644 --- a/lib/tests/test_tcp.c +++ b/lib/tests/test_tcp.c | |||
@@ -21,30 +21,38 @@ | |||
21 | #include "tap.h" | 21 | #include "tap.h" |
22 | 22 | ||
23 | int main(void) { | 23 | int main(void) { |
24 | char **server_expect; | ||
25 | int server_expect_count = 3; | ||
26 | |||
27 | plan_tests(9); | 24 | plan_tests(9); |
28 | 25 | ||
26 | char **server_expect; | ||
27 | const int server_expect_count = 3; | ||
29 | server_expect = malloc(sizeof(char *) * server_expect_count); | 28 | server_expect = malloc(sizeof(char *) * server_expect_count); |
30 | 29 | ||
31 | server_expect[0] = strdup("AA"); | 30 | server_expect[0] = strdup("AA"); |
32 | server_expect[1] = strdup("bb"); | 31 | server_expect[1] = strdup("bb"); |
33 | server_expect[2] = strdup("CC"); | 32 | server_expect[2] = strdup("CC"); |
34 | 33 | ||
35 | ok(np_expect_match("AA bb CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS, | 34 | ok(np_expect_match("AA bb CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == |
35 | NP_MATCH_SUCCESS, | ||
36 | "Test matching any string at the beginning (first expect string)"); | 36 | "Test matching any string at the beginning (first expect string)"); |
37 | ok(np_expect_match("bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS, | 37 | ok(np_expect_match("bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == |
38 | NP_MATCH_SUCCESS, | ||
38 | "Test matching any string at the beginning (second expect string)"); | 39 | "Test matching any string at the beginning (second expect string)"); |
39 | ok(np_expect_match("b", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_RETRY, | 40 | ok(np_expect_match("b", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_RETRY, |
40 | "Test matching any string at the beginning (substring match)"); | 41 | "Test matching any string at the beginning (substring match)"); |
41 | ok(np_expect_match("XX bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_FAILURE, | 42 | ok(np_expect_match("XX bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == |
43 | NP_MATCH_FAILURE, | ||
42 | "Test with strings not matching at the beginning"); | 44 | "Test with strings not matching at the beginning"); |
43 | ok(np_expect_match("XX CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_FAILURE, "Test matching any string"); | 45 | ok(np_expect_match("XX CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == |
44 | ok(np_expect_match("XX", server_expect, server_expect_count, 0) == NP_MATCH_RETRY, "Test not matching any string"); | 46 | NP_MATCH_FAILURE, |
45 | ok(np_expect_match("XX AA bb CC XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_SUCCESS, | 47 | "Test matching any string"); |
48 | ok(np_expect_match("XX", server_expect, server_expect_count, 0) == NP_MATCH_RETRY, | ||
49 | "Test not matching any string"); | ||
50 | ok(np_expect_match("XX AA bb CC XX", server_expect, server_expect_count, NP_MATCH_ALL) == | ||
51 | NP_MATCH_SUCCESS, | ||
46 | "Test matching all strings"); | 52 | "Test matching all strings"); |
47 | ok(np_expect_match("XX bb CC XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_RETRY, "Test not matching all strings"); | 53 | ok(np_expect_match("XX bb CC XX", server_expect, server_expect_count, NP_MATCH_ALL) == |
54 | NP_MATCH_RETRY, | ||
55 | "Test not matching all strings"); | ||
48 | ok(np_expect_match("XX XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_RETRY, | 56 | ok(np_expect_match("XX XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_RETRY, |
49 | "Test not matching any string (testing all)"); | 57 | "Test not matching any string (testing all)"); |
50 | 58 | ||