41 |
42 | |
71 | Table of Contents
72 |
|
The latest release can be downloaded from this page.
94 | 95 |Read-only access to the latest development version:
96 | 97 | git clone git://github.com/lvc/api-sanity-checker
98 |
99 |
100 | This program is free software. You may use, redistribute and/or modify it under the terms of the GNU GPL or GNU LGPL
102 | 103 | 104 |The tool is ready-to-use after extracting the archive.
132 | 133 |You can also use a Makefile to install the tool into the system:
134 | sudo make install prefix=PREFIX [/usr, /usr/local]
135 | This command will install the api-sanity-checker program into the PREFIX/bin system directory and private modules into the PREFIX/share.
144 | <version> 145 | 0.3.4 146 | </version> 147 | 148 | <headers> 149 | /usr/local/libssh/0.3.4/include/ 150 | </headers> 151 | 152 | <libs> 153 | /usr/local/libssh/0.3.4/lib/ 154 | </libs> 155 |156 |
api-sanity-checker -lib NAME -d VER.xml -gen
161 |
162 | You can view generated tests using the index file:
163 |
164 | tests/NAME/VER/view_tests.html
165 |
166 | or manually in the directory:
167 |
168 | tests/NAME/VER/groups/
169 |
170 | Command to build tests:
171 |
172 | api-sanity-checker -l NAME -d VER.xml -build
173 |
174 | Command to execute tests:
175 |
176 | api-sanity-checker -l NAME -d VER.xml -run
177 |
178 | The test report will be generated to:
179 |
180 | test_results/NAME/VER/test_results.html
181 |
182 |
183 |
184 | | Library | Version | Number of Tests | Problems Found |
|---|---|---|---|
| FreeType2 | 189 |2.3.11 | 190 |178 | 191 |13 | 192 |
| Glibc | 195 |2.13 | 196 |1996 | 197 |340 | 198 |
| libX11 | 201 |1.3.4 | 202 |778 | 203 |286 | 204 |
249 | #include <freetype/freetype.h> 250 | int main(int argc, char *argv[]) 251 | { 252 | FT_Library alibrary = 0; 253 | FT_Init_FreeType(&alibrary); //initialize "alibrary" 254 | 255 | FT_Face face = 0; 256 | FT_New_Face( 257 | alibrary, 258 | "sample.ttf", 259 | 0, 260 | &face); //initialize "face" 261 | 262 | FT_Size size = 0; 263 | FT_New_Size(face, &size); //initialize "size" 264 | 265 | FT_Activate_Size(size); //target call 266 | return 0; 267 | } 268 | 269 |270 |
41 |
42 | |
50 | Table of Contents
51 |
|
63 | <version> 64 | /* Version of the library */ 65 | </version> 66 | 67 | <headers> 68 | /* The list of paths to header files or/and 69 | directories with header files, one per line */ 70 | </headers> 71 | 72 | <libs> 73 | /* The list of paths to shared libraries or/and 74 | directories with shared libraries, one per line */ 75 | </libs> 76 |77 |
84 | <include_paths> 85 | /* The list of paths to be searched for header files 86 | needed for compiling of library headers, one per 87 | line. NOTE: If you define this section then the tool 88 | will not automatically detect include paths */ 89 | </include_paths> 90 | 91 | <add_include_paths> 92 | /* The list of include paths that should be added 93 | to the automatically detected include paths, one per 94 | line */ 95 | </add_include_paths> 96 | 97 | <skip_include_paths> 98 | /* The list of include paths that will be removed from 99 | the list of automatically generated include paths, one 100 | per line */ 101 | </skip_include_paths> 102 | 103 | <gcc_options> 104 | /* Additional GCC options, one per line */ 105 | </gcc_options> 106 | 107 | <include_preamble> 108 | /* The list of header files that should be included 109 | before other headers, one per line. For example, it 110 | is a tree.h for libxml2 and ft2build.h for freetype2 111 | library */ 112 | </include_preamble> 113 | 114 | <defines> 115 | /* Add defines at the headers compiling stage, one per 116 | line: 117 | #define A B 118 | #define C D */ 119 | </defines> 120 | 121 | <add_namespaces> 122 | /* The list of namespaces that should be added to the 123 | alanysis if the tool cannot find them automatically, 124 | one per line */ 125 | </add_namespaces> 126 | 127 | <skip_types> 128 | /* The list of data types, that 129 | should not be checked, one per line */ 130 | </skip_types> 131 | 132 | <skip_symbols> 133 | /* The list of functions (mangled/symbol names in C++), 134 | that should not be checked, one per line */ 135 | </skip_symbols> 136 | 137 | <skip_namespaces> 138 | /* The list of C++ namespaces, that 139 | should not be checked, one per line */ 140 | </skip_namespaces> 141 | 142 | <skip_constants> 143 | /* The list of constants that should not be checked, 144 | one name per line */ 145 | </skip_constants> 146 | 147 | <skip_headers> 148 | /* The list of header files and/or directories 149 | with header files that should not be checked, one per 150 | line */ 151 | </skip_headers> 152 | 153 | <skip_libs> 154 | /* The list of shared libraries and/or directories 155 | with shared libraries that should not be checked, one 156 | per line */ 157 | </skip_libs> 158 | 159 | <skip_including> 160 | /* The list of header files, that cannot be included 161 | directly (or non-self compiled ones), one per line */ 162 | </skip_including> 163 | 164 | <search_headers> 165 | /* List of directories to be searched 166 | for header files to automatically 167 | generate include paths, one per line */ 168 | </search_headers> 169 | 170 | <search_libs> 171 | /* List of directories to be searched 172 | for shared librariess to resolve 173 | dependencies, one per line */ 174 | </search_libs> 175 | 176 | <tools> 177 | /* List of directories with tools used 178 | for analysis (GCC toolchain), one per line */ 179 | </tools> 180 | 181 | <cross_prefix> 182 | /* GCC toolchain prefix. 183 | Examples: 184 | arm-linux-gnueabi 185 | arm-none-symbianelf */ 186 | </cross_prefix> 187 |188 |
195 | <test_include_preamble> 196 | /* The list of header files that should be 197 | included in each test case before other 198 | headers, one per line */ 199 | </test_include_preamble> 200 | 201 | <test_defines> 202 | /* Add defines to test cases */ 203 | </test_defines> 204 | 205 | <libs_depend> 206 | /* The list of paths to libraries that should be 207 | provided to gcc for resolving undefined symbols 208 | (if NEEDED elf section doesn't include them) */ 209 | </libs_depend> 210 | 211 | <opaque_types> 212 | /* The list of opaque types, one per line */ 213 | </opaque_types> 214 | 215 | <libgroup> 216 | <name> 217 | /* Name of the libgroup */ 218 | </name> 219 | 220 | <symbols> 221 | /* The list of symbols (mangled names in C++) 222 | in the group that should be tested, one 223 | per line */ 224 | </symbols> 225 | </libgroup> 226 | 227 | <out_params> 228 | /* Associating of out(returned)-parameters 229 | with symbols, one entry per line: 230 | symbol:param_name 231 | or 232 | symbol:param_number 233 | Examples: 234 | dbus_parse_address:entry 235 | dbus_parse_address:2 */ 236 | </out_params> 237 | 238 | <skip_warnings> 239 | /* The list of warnings that should not be shown in 240 | the report, one pattern per line */ 241 | </skip_warnings> 242 | 243 |244 |
253 | <version> 254 | 0.3.4 255 | </version> 256 | 257 | <headers> 258 | /usr/local/libssh/0.3.4/include/ 259 | </headers> 260 | 261 | <libs> 262 | /usr/local/libssh/0.3.4/lib/ 263 | </libs> 264 |265 |
271 | <version> 272 | 1.28.0 273 | </version> 274 | 275 | <headers> 276 | /usr/local/atk-1.28.0/include/atk-1.0/atk/atk.h 277 | </headers> 278 | 279 | <libs> 280 | /usr/local/atk-1.28.0/lib/ 281 | </libs> 282 | 283 | <include_paths> 284 | /usr/include/glib-2.0/ 285 | /usr/lib/glib-2.0/include/ 286 | </include_paths> 287 |288 |
294 | <version> 295 | 2.7.6 296 | </version> 297 | 298 | <headers> 299 | /usr/local/libxml2-2.7.6/include/ 300 | </headers> 301 | 302 | <libs> 303 | /usr/local/libxml2-2.7.6/lib/libxml2.so.2.7.6 304 | </libs> 305 | 306 | <include_preamble> 307 | tree.h 308 | </include_preamble> 309 |310 |
316 | <version> 317 | 1.3.2 318 | </version> 319 | 320 | <headers> 321 | /usr/local/libX11-1.3.2/include/ 322 | </headers> 323 | 324 | <libs> 325 | /usr/local/libX11-1.3.2/lib/ 326 | </libs> 327 | 328 | <include_preamble> 329 | Xlib.h 330 | </include_preamble> 331 |332 |
338 | <version> 339 | 10 340 | </version> 341 | 342 | <headers> 343 | /home/RIM/bbndk/target_10_0_9_1673/qnx6/usr/include/bb/ 344 | </headers> 345 | 346 | <search_headers> 347 | /home/RIM/bbndk/target_10_0_9_1673/qnx6/usr/include/ 348 | </search_headers> 349 | 350 | <libs> 351 | /home/RIM/bbndk/target_10_0_9_1673/qnx6/x86/usr/lib/ 352 | </libs> 353 | 354 | <tools> 355 | /home/RIM/bbndk/host_10_0_9_404/linux/x86/usr/bin/ 356 | </tools> 357 | 358 | <cross_prefix> 359 | i486-pc-nto-qnx8.0.0 360 | </cross_prefix> 361 |362 |
368 | <version> 369 | 5.5.0 370 | </version> 371 | 372 | <headers> 373 | /usr/local/Qt-5.5.0/include/QtCore 374 | </headers> 375 | 376 | <libs> 377 | /usr/local/Qt-5.5.0/lib/libQt5Core.so.5.5.0 378 | </libs> 379 | 380 | <include_paths> 381 | /usr/local/Qt-5.5.0/include/ 382 | </include_paths> 383 | 384 | <skip_headers> 385 | /private/ 386 | qt_windows.h 387 | qatomic_* 388 | *_impl.h 389 | </skip_headers> 390 | 391 | <gcc_options> 392 | -fvisibility=hidden 393 | -fvisibility-inlines-hidden 394 | -fPIC 395 | -Wall 396 | -W 397 | -D_REENTRANT 398 | -DQT_NO_CAST_FROM_ASCII 399 | -DQT_NO_CAST_TO_ASCII 400 | -DQT_NO_STL 401 | -DQT_SHARED 402 | </gcc_options> 403 |404 |
410 | <version> 411 | 1.1.22 412 | </version> 413 | 414 | <headers> 415 | /usr/local/libxslt-1.1.22/include/ 416 | </headers> 417 | 418 | <libs> 419 | /usr/local/libxslt-1.1.22/lib/libxslt.so 420 | /usr/local/libxslt-1.1.22/lib/libexslt.so 421 | </libs> 422 | 423 | <include_paths> 424 | /usr/include/libxml2/ 425 | </include_paths> 426 | 427 | <include_preamble> 428 | xsltInternals.h 429 | </include_preamble> 430 |431 |
437 | <version> 438 | 2.26.1 439 | </version> 440 | 441 | <headers> 442 | /usr/local/libxml++-2.26.1/include/ 443 | /usr/local/libxml++-2.26.1/lib/libxml++-2.6/include/ 444 | </headers> 445 | 446 | <libs> 447 | /usr/local/libxml++-2.26.1/lib/ 448 | </libs> 449 | 450 | <include_paths> 451 | /usr/include/glib-2.0/ 452 | /usr/lib/glib-2.0/include/ 453 | /usr/include/glibmm-2.4/ 454 | /usr/lib/glibmm-2.4/include/ 455 | </include_paths> 456 |457 |
463 | <version> 464 | 1.26.0 465 | </version> 466 | 467 | <headers> 468 | /usr/local/pango-1.26.0/include/ 469 | </headers> 470 | 471 | <libs> 472 | /usr/local/pango-1.26.0/lib/ 473 | </libs> 474 | 475 | <include_paths> 476 | /usr/include/glib-2.0/ 477 | /usr/lib/glib-2.0/include/ 478 | /usr/include/cairo/ 479 | /usr/include/freetype2/ 480 | /usr/include/X11/ 481 | </include_paths> 482 | 483 | <include_preamble> 484 | pango.h 485 | </include_preamble> 486 |487 |
493 | <version> 494 | 2.18.4 495 | </version> 496 | 497 | <headers> 498 | /usr/local/gtk+-2.18.4/include/gtk-2.0/gdk/gdk.h 499 | /usr/local/gtk+-2.18.4/include/gtk-2.0/gtk/gtk.h 500 | /usr/local/gtk+-2.18.4/include/gail-1.0/ 501 | /usr/local/gtk+-2.18.4/include/gtk-unix-print-2.0/ 502 | </headers> 503 | 504 | <libs> 505 | /usr/local/gtk+-2.18.4/lib/ 506 | </libs> 507 | 508 | <include_paths> 509 | /usr/include/atk-1.0/ 510 | /usr/include/glib-2.0/ 511 | /usr/lib/glib-2.0/include/ 512 | /usr/include/cairo/ 513 | /usr/include/pango-1.0/ 514 | </include_paths> 515 |516 |
522 | <version> 523 | 2.22.2 524 | </version> 525 | 526 | <headers> 527 | /usr/local/glib-2.22.2/include/glib-2.0/glib.h 528 | /usr/local/glib-2.22.2/include/glib-2.0/glib-object.h 529 | /usr/local/glib-2.22.2/include/glib-2.0/gmodule.h 530 | </headers> 531 | 532 | <libs> 533 | /usr/local/glib-2.22.2/lib/ 534 | </libs> 535 | 536 | <include_paths> 537 | /usr/local/glib-2.22.2/lib/glib-2.0/include/ 538 | </include_paths> 539 |540 |
546 | <version> 547 | 2.28.0 548 | </version> 549 | 550 | <headers> 551 | /usr/local/libsoup-2.28.0/include/ 552 | </headers> 553 | 554 | <libs> 555 | /usr/local/libsoup-2.28.0/lib/ 556 | </libs> 557 | 558 | <include_paths> 559 | /usr/include/glib-2.0/ 560 | /usr/lib/glib-2.0/include/ 561 | </include_paths> 562 |563 |
569 | <version> 570 | 4.9.9.1 571 | </version> 572 | 573 | <headers> 574 | /usr/local/include/allegro5/allegro.h 575 | </headers> 576 | 577 | <libs> 578 | /usr/local/lib/liballegro-4.9.9.so 579 | </libs> 580 |581 |
587 | <version> 588 | 1.9.0.1 589 | </version> 590 | 591 | <headers> 592 | /usr/local/mathgl-1.9.0.1/include/ 593 | </headers> 594 | 595 | <libs> 596 | /usr/local/mathgl-1.9.0.1/lib/ 597 | </libs> 598 | 599 | <include_paths> 600 | /usr/local/gsl-1.9/include/ 601 | </include_paths> 602 |603 |
609 | <version> 610 | 1.9 611 | </version> 612 | 613 | <headers> 614 | /usr/local/gsl-1.9/include/ 615 | </headers> 616 | 617 | <libs> 618 | /usr/local/gsl-1.9/lib/ 619 | </libs> 620 | 621 | <include_preamble> 622 | stdlib.h 623 | </include_preamble> 624 |625 |
631 | <version> 632 | 7 633 | </version> 634 | 635 | <headers> 636 | /usr/local/libjpeg-7/include/jpeglib.h 637 | </headers> 638 | 639 | <libs> 640 | /usr/local/libjpeg-7/lib/ 641 | </libs> 642 | 643 | <include_preamble> 644 | stdio.h 645 | </include_preamble> 646 |647 |
41 |
42 | |
55 | Table of Contents
56 |
|
77 | Obj->setSourceModel( $(QAbstractItemModel*) );
78 | }
79 |
88 | xmlListPtr l=$[xmlListCreate];
89 | int num=100;
90 | xmlListPushBack(l,&num);
91 | return l;
92 | }
93 | 154 | QWidgetAction* Obj = new QWidgetAction($(QWidget*)); 155 | Obj->setDefaultWidget($(QWidget*)); 156 | return Obj;157 | } 158 |
194 | <kind> 195 | /* Kind of the specialized type. 196 | Select it from the following list: 197 | normal 198 | common_param 199 | common_retval 200 | env 201 | common_env */ 202 | </kind> 203 | 204 | <data_type> 205 | /* Name of the corresponding real data type, 206 | one per line. You can specify several data 207 | types if kind is 'common_param' or 208 | 'common_retval', one per line. This section 209 | is not used if kind is 'env' or 210 | 'common_env' */ 211 | </data_type> 212 | 213 | <value> 214 | /* Value for initialization (true, 1.0, 215 | "string", ...) */ 216 | </value> 217 | 218 | <pre_condition> 219 | /* Precondition on associated function parameter. 220 | Example: $0!=NULL */ 221 | </pre_condition> 222 | 223 | <post_condition> 224 | /* Postcondition on associated function return 225 | value or parameter. 226 | Example: $0!=NULL && $obj.style() == DotLine 227 | */ 228 | </post_condition> 229 | 230 | <init_code> 231 | /* Code that should be invoked before function call. 232 | Example: $0->start(); */ 233 | </init_code> 234 | 235 | <final_code> 236 | /* Code that should be invoked after function call. 237 | Example: $0->end(); */ 238 | </final_code> 239 | 240 | <global_code> 241 | /* Declarations of auxiliary functions and global 242 | variables, header includes */ 243 | </global_code> 244 | 245 | <decl_code> 246 | /* Code that will be pasted instead of parameter 247 | automatic declaration. Example: char \$0[16]; */ 248 | </decl_code> 249 | 250 | <associating> 251 | <interfaces> 252 | /* List of interfaces (mangled/symbol names in 253 | C++) that will be associated with the 254 | specialized type, one per line */ 255 | </interfaces> 256 | 257 | <except> 258 | /* List of interfaces (mangled/symbol names in 259 | C++) that will not be associated with the 260 | specialized type, one per line. This section 261 | is used if kind is 'common_env', 262 | 'common_param' or 'common_return' */ 263 | </except> 264 | 265 | <links> 266 | /* Associations with the return value, 267 | parameters or/and object, one per line: 268 | param1 269 | param2 270 | ... 271 | object 272 | retval */ 273 | </links> 274 | 275 | <param_name> 276 | /* Associations with the parameters by name, 277 | one per line: 278 | param_name1 279 | param_name2 280 | param_name3 281 | ... 282 | */ 283 | </param_name> 284 | </associating> 285 | 286 | <associating> 287 | /* Other associations */ 288 | </associating> 289 | 290 | <name> 291 | /* Name of the specialized type */ 292 | </name> 293 | 294 | <libs> 295 | /* External shared objects, one per line. 296 | If spectype contains call of the functions from 297 | some external shared objects then these objects 298 | should be listed here. Corresponding external 299 | header files should be included in global_code */ 300 | </libs>301 | </spec_type> 302 |
309 | <collection> 310 | 311 | <spec_type> 312 | /* Specialized Type №1 */ 313 | </spec_type> 314 | 315 | <spec_type> 316 | /* Specialized Type №2 */ 317 | </spec_type> 318 | 319 | ... 320 | 321 | </collection> 322 | 323 | <collection> 324 | /* Other Collection */ 325 | </collection> 326 |327 |
api-sanity-checker -specialized-types SPECTYPES.xml -gen -build -run
332 |
333 |
334 | api-sanity-checker -test-data DIR -specialized-types SPECTYPES.xml -gen -build -run
338 |
339 | For accessing test data files in the attributes of specialized types you should use TEST_DATA_PATH("file") construction. Test generator will copy specified file to the local "testdata/" directory and replace TEST_DATA_PATH("file") with the "testdata/file" in the generated code.
340 |
342 | QSound* create_QSound()
343 | {
344 | QSound* Obj=new QSound(TEST_DATA_PATH("SoundFile.wav"));
345 | Obj->setLoops(5);
346 | return Obj;
347 | }
348 |
349 | 357 | <spec_type> 358 | <kind> 359 | common_env 360 | </kind> 361 | 362 | <init_code> 363 | g_type_init(); 364 | </init_code> 365 | </spec_type> 366 | 367 | <spec_type> 368 | <kind> 369 | common_param 370 | </kind> 371 | 372 | <data_type> 373 | GObject* 374 | </data_type> 375 | 376 | <value> 377 | g_object_new (G_TYPE_OBJECT, NULL) 378 | </value> 379 | 380 | <global_code> 381 | #include <glib.h> 382 | </global_code> 383 | </spec_type> 384 |385 |
392 | <spec_type> 393 | <kind> 394 | common_param 395 | </kind> 396 | 397 | <data_type> 398 | xmlListPtr 399 | </data_type> 400 | 401 | <value> 402 | create_filled_list() 403 | </value> 404 | 405 | <constraint> 406 | $0!=NULL 407 | </constraint> 408 | 409 | <global_code> 410 | xmlListPtr create_filled_list() 411 | { 412 | xmlListPtr l = $[xmlListCreate]; 413 | int num = 100; 414 | xmlListPushBack(l, &num); 415 | return l; 416 | } 417 | </global_code> 418 | </spec_type> 419 |420 |
427 | <spec_type> 428 | <kind> 429 | normal 430 | </kind> 431 | 432 | <data_type> 433 | xmlListPtr 434 | </data_type> 435 | 436 | <value> 437 | create_filled_list() 438 | </value> 439 | 440 | <global_code> 441 | xmlListPtr create_filled_list() 442 | { 443 | xmlListPtr l = $[xmlListCreate]; 444 | int num = 100; 445 | xmlListPushBack(l, &num); 446 | return l; 447 | } 448 | </global_code> 449 | 450 | <associating> 451 | <interfaces> 452 | xmlListAppend 453 | </interfaces> 454 | 455 | <links> 456 | param1 457 | </links> 458 | </associating> 459 | </spec_type> 460 |461 |
468 | <spec_type> 469 | <kind> 470 | common_env 471 | </kind> 472 | 473 | <global_code> 474 | #include<QApplication> 475 | #include<QTimer> 476 | </global_code> 477 | 478 | <init_code> 479 | #ifdef Q_WS_X11 480 | bool useGUI = getenv( "DISPLAY" ) != 0; 481 | #else 482 | bool useGUI = TRUE; 483 | #endif 484 | QApplication* app = new QApplication(argc, argv, 485 | useGUI); 486 | </init_code> 487 | 488 | <final_code> 489 | QTimer::singleShot(100, app, SLOT(quit())); 490 | app->exec(); 491 | </final_code> 492 | </spec_type> 493 |494 |
501 | <spec_type> 502 | <kind> 503 | common_env 504 | </kind> 505 | 506 | <init_code> 507 | gtk_init(&argc, &argv); 508 | </init_code> 509 | 510 | <final_code> 511 | gtk_timeout_add(100, &main_loop_quit, NULL); 512 | gtk_main(); 513 | </final_code> 514 | 515 | <global_code> 516 | #include <gtk.h> 517 | gboolean main_loop_quit(gpointer data) 518 | { 519 | gtk_main_quit(); 520 | return FALSE; 521 | } 522 | </global_code> 523 | 524 | <associating> 525 | <except> 526 | gtk_init 527 | gtk_init_check 528 | gtk_parse_args 529 | gdk_init 530 | gdk_init_check 531 | gdk_parse_args 532 | gtk_test_init 533 | </except> 534 | </associating> 535 | </spec_type> 536 |537 |
544 | <spec_type> 545 | <kind> 546 | common_param 547 | </kind> 548 | 549 | <data_type> 550 | xmlTextReaderPtr 551 | </data_type> 552 | 553 | <value> 554 | create_reader() 555 | </value> 556 | 557 | <global_code> 558 | xmlTextReaderPtr create_reader(int n) 559 | { 560 | xmlTextReaderPtr reader = xmlReaderForFile(TEST_DATA_PATH("file.xml"), NULL, 0); 561 | int i; 562 | for(i=0; i<n; i+=1) 563 | { 564 | xmlTextReaderRead(reader); 565 | } 566 | return reader; 567 | } 568 | </global_code> 569 | </spec_type> 570 |571 |
578 | <spec_type> 579 | <kind> 580 | normal 581 | </kind> 582 | 583 | <data_type> 584 | void* 585 | </data_type> 586 | 587 | <constraint> 588 | $0!=NULL 589 | </constraint> 590 | 591 | <associating> 592 | <interfaces> 593 | xmlLinkGetData 594 | </interfaces> 595 | 596 | <links> 597 | retval 598 | </links> 599 | </associating> 600 | </spec_type> 601 |602 |
40 |
41 |