summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* gimarshallingtests: Use g_assert_cmpfloat_with_epsilonIain Lane2020-04-051-6/+6
| | | | Comparing floats directly doesn't always work on all architectures.
* Fix regress scanner testsChun-wei Fan2020-02-062-5/+5
| | | | | | | | | There is no way that non-GCC/CLang compilers will pass this test because the source position will never match the position that is in tests/scanner/Regress-1.0-expected.gir. Fix this the fast way: define a macro according to the compiler check and update the corresponding source position
* test_scanner.py: Fix path tests on WindowsChun-wei Fan2020-01-161-2/+3
| | | | | | We may get drive letters and paths either in upper or lower cases in Windows, which are actually no different. Ignore the cases in this case.
* Visual Studio builds: Use -utf-8 where availableChun-wei Fan2020-01-153-0/+14
| | | | | | | | | | | | This avoids compilation erroring out on C4819 (Unicode handling issue in the Visual Studio compiler), notably when running on Chinese, Japanese and Korean (CJK) locales. This also applies -utf-8 into the cflags passed into the various g-ir-scanner command lines that are used to generate the *.gir files, where -utf-8 is available, so that we don't get flooded with C4819 warnings during the build, and therefore avoid potential mishaps, as C4819 is a real warning that warngs us the code may be incorrectly built.
* gitypelibtest: make tests fail if the library can't be foundChristoph Reiter2019-10-191-1/+3
| | | | | | | | Check that g_object_info_get_ref_function_pointer() actually returns something, which it doesn't if the shared lib isn't found. In case a shared lib isn't found g-i will emit a warning, so also make sure we fail on warnings to avoid similar problems in the future.
* tests: Actually test libregress by specifying the LD_LIBRARY_PATHCorentin Noël2019-10-191-0/+4
|
* meson: change "doctool" from a boolean to a feature optionChristoph Reiter2019-09-301-1/+1
| | | | | | | Similar to !180 this should prevent devs from not running all tests by accident. This also adds some checks for the required doctool dependencies, mako and markdown.
* meson: change "cairo" from a boolean to a feature optionChristoph Reiter2019-09-281-7/+7
| | | | | | | | | We require cairo only to run all tests and thus default it to false. This usually results in developers not using it when working on changes and tests depending on cairo then failing in CI. This changes it to a feature option that defaults to auto, so that devs that have cairo headers installed will automatically use it.
* Support array arguments with static keywordEmmanuele Bassi2019-09-157-303/+455
| | | | | | | | | | | | | | | | | | | | | | | C99 allows defining an array argument with a fixed size as: void foo (int arr[static 10]) Compilers conforming to the C99 specification will be able to warn if the function is called with NULL or with an array smaller than the specified length, something that does not happen when using pre-C99 declarations like: void foo (int arr[10]) As the declaration above is identical to: void foo (int arr[]) Which is, in turn, identical to: void foo (int *arr) Fixes: #309
* tests: Don't include "config.h" in installed filesPhilip Chimento2019-08-158-163/+181
| | | | | | These tests get installed, so config.h may not be available. Do the same thing that gimarshallingtests.c and regress.c already do, and include config.h conditionally.
* ccompiler: use the distutils linker in the dumperChristoph Reiter2019-08-081-0/+5
| | | | | No need to hardcode things since distutils looks it up. Similar to !170 but for Windows.
* regress: Add regression test for signal with GError paramPhilip Chimento2019-08-0113-283/+701
| | | | | | | | This exercises the little-used code path where a signal is emitted with a nullable GError as a parameter. It's modeled after GstPbutils.Discoverer's 'discovered' signal. See GNOME/gjs#262.
* transformer: only include function macros from headers. See #159Christoph Reiter2019-07-223-46/+0
| | | | | We already do the same thing for constants (see _create_const()). Otherwise macros in .c files which aren't namespaced will trigger a warning.
* scanner: parse and expose function macrosMathieu Duponchelle2019-07-1944-5/+997
| | | | | This is useful for documentation tools, and other utilities that rely on full introspection of the C API of a given library.
* gimarshallingtests: Add a marshalling test case for GPtrArrays and GArrays ↵Stéphane Seng2019-07-142-0/+52
| | | | | | | | | | | | | | | of structures Prior to this, the only marshalling test cases available for GPtrArrays were for GPtrArrays of strings. This commit adds a marshalling test case for GPtrArrays of structures, with the same objective than the gi_marshalling_tests_array_zero_terminated_return_struct() test case. This also adds a similar marshalling test case for GArrays of structures, for completeness. This is a follow-up to https://gitlab.gnome.org/GNOME/gjs/issues/9 where a regression has been detected with these types of GPtrArrays.
* girepository: Return pointer array for interface cachePhilip Chimento2019-06-201-0/+24
| | | | | | | | | | | | | In g_irepository_get_object_gtype_interfaces(), returning the address of the first GIBaseInfo* does not work reliably, because the GIBaseInfos are not necessarily stored contiguously. So the second and subsequent ones might be garbage. Instead, return the address of the array of GIBaseInfo pointers. Add a test that verifies the functionality, as well. This is unfortunately an API and ABI break.
* gi-test: Fix gir file testsChun-wei Fan2019-05-021-1/+1
| | | | | | | | | | | | | | | | | | | Meson unfortunately does not normalize the paths for us, so we couldn't just rely on it to give us the correct target name without the full target path when the path separator is not '/' (such as on Visual Studio builds, where the path separator is '\\' (with escape character). This means that, that on Visual Studio builds, targetname would be: D:\\gi.build\\tests\\scanner\\Typedefs-1.0.gir instead of: Typedefs-1.0.gir Since we have the targetbase variable which actually has the correct info we need, use that to deduce the correct reference .gir file to compare to.
* build: Force-include msvc_recommended_pragmas.h on Visual StudioChun-wei Fan2019-04-302-14/+26
| | | | | | | | | | By doing so, we essentially cover the various compiler flags that we want to use for non-Visual Studio builds to check for warnings that might cause real concern. This also skips the checks for the various GCC-isque CFlag checks that are scattered in the various build files on Visual Studio builds, since they are essentially meaningless on Visual Studio builds.
* scanner: Fix error on Windows in case source files are on different drivesChristoph Reiter2019-04-211-0/+10
| | | | | | | | | os.path.commonpath() raises ValueError if the paths given to it are on different drives. Handle that case by giving up and add a test. Reported here: https://github.com/msys2/MINGW-packages/pull/5258#issuecomment-485230864
* regress: Check array length before accessingPhilip Chimento2019-04-152-37/+43
|
* regress: Initialize all struct fields, or mark intent not toPhilip Chimento2019-04-151-4/+4
| | | | | | | In some cases we don't initialize all the struct fields of Regress structs. We should either initialize them all, in the case of fields that were added later; or mark that we don't intend to initialize them all, by using C99 designated initializers.
* tests: Mark unused function arguments with G_GNUC_UNUSEDPhilip Chimento2019-04-154-222/+247
| | | | | | | These files are exported for other projects to compile, so they should compile with as few compiler warnings as possible. If GJS or PyGObject has -Wunused-parameter turned on, then there should not be warnings in these files.
* meson: always pass --qiet to g-ir-scannerChristoph Reiter2019-04-073-0/+15
| | | | Less noisy build
* shlibs: fall back to basename on macOS for relative paths. Fixes #222Christoph Reiter2019-03-251-5/+26
| | | | | | | | | | | | | | | | | | | On macOS we ideally want to write the final absolute path of the library into the gir and typelib. Up until now we inferred the install path from the .la file in case we used libtool and through otool in case we weren't using libtool hoping that the install_name was matching the install path. meson currently sets the install_name of libraries to "@rpath/foo.dylib" and adds rpaths to the executables in the build dir. Only during install does it change the install_name to the absolute target path in all places. Since we get called during build time we only get the @rpath from otool, which then makes things fail at runtime since the executables don't have the matching rpath set. To make this somewhat work just fall back to the basename for relative paths, so we dlopen "foo.dylib" and depend on things being in /usr/local/lib or DYLD_FALLBACK_LIBRARY_PATH including the lib path (see man dlopen)
* tests: Fix compatibility with Python 3.5Tomasz Miąsko2019-03-151-2/+2
| | | | | | | | Use call_count to verify the number of calls. This replaces assert_called_once used previously, which is only available since Python 3.6. Fixes issue #274.
* Drop autotools build systemChristoph Reiter2019-03-116-523/+0
|
* Revert "Restore original meaning of disguised attribute."Christoph Reiter2019-01-163-6/+12
| | | | | | This reverts commit f606183a010fbec4382acb728882cc0eddbaf7f7. See https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/9#note_409979
* maintransformer: Don't warn on (optional) annotations on (inout)Guido Günther2019-01-131-5/+5
| | | | This makes the scanner consistent with the docs.
* autotools: don't pass all the libregress cflags to the scanner. Fixes #226Christoph Reiter2019-01-121-1/+4
| | | | | | | | | | | | They contain things like -fvisibility=hidden which, in case of building with CFLAGS="-flto -O2" LDFLAGS="-Wl,--as-needed -flto", results in the linker throwing out unused symbols and not linking the dumper against libregress. This results in errors like: Invalid GType function: 'regress_test_enum_get_type' Failed to find symbol 'regress_test_enum_get_type' Fix this by only passing the required CFLAGS to the scanner instead.
* Restore original meaning of disguised attribute.Tomasz Miąsko2019-01-103-12/+6
| | | | | | | | | | | | | | | | > Certain types like GIConv and GdkAtom are pointers internally but don't > look like pointers when referenced. They have the form. > > typedef struct _X *X; > > Parse these as structures/records but mark them in the gir with a 'disguised' > attribute so that we know that they need special handling. Additionally, stop relaying on disguised attribute when deciding whether to render a page. Check number of fields instead, so as to avoid introducing large regression in the docs. Fixes #101.
* message: simplify handling of error levelsChristoph Reiter2019-01-103-10/+10
| | | | | | | | Instead of allowing each error level to be enabled just enable all of them through the enable_warnings() method. This matches what the code is currently doing (minus that one helper script) and simplifies things. Also remove the error count, it's not used.
* maintransformer: parse deprecation annotations for section blocks. Fixes #213Christoph Reiter2019-01-093-1/+75
| | | | | | | | | | The scanner matches gtk-doc sections which match the lower case type name to the type and uses that for the type documentation. The only problem is it only takes the docs and none of the other annotations like deprecation info etc. This changes things to also parse the annotations in that case and adds some tests while at it.
* tests: Add functions using flat struct arraysTomasz Miąsko2019-01-0825-0/+1091
| | | | | | | | | | | | | | Relatively common in practice are: * output with transfer full, which is already covered by `regress_test_array_struct_out`, * input with transfer none, covered by a new `regress_test_array_struct_in_none` Other variants are quite esoteric, but it still might be useful to include them so that bindings can verify that they are handled gracefully, e.g., by reporting an error instead of crashing. Issue #90
* tests: add some tests for get_source_root_dirsChristoph Reiter2019-01-083-1/+33
| | | | | To make it easier to test make sure it always returns absolute paths. Also fix a typo, oops!
* scanner: Flatten multi-dimensional arrays fieldsTomasz Miąsko2019-01-073-0/+68
| | | | | | | | | | | | | Provide partial support for multi-dimensional arrays by representing them as flattened one dimensional array with size that is equal to product of sizes in each dimension. Previously only the first dimension would be actually used. This should be sufficient to ensure that those fields have layout compatible with C, without using nested array types that are currently unsupported by vapigen Issue #255.
* scanner: Remove incorrect c:type generated for array of synthesized unionsTomasz Miąsko2019-01-061-1/+1
| | | | | | | | This also reverts workaround introduced to support this use case in f77cfc4275b1fba4f9fedea6e40b00e0ebbe142c, since it is no longer necessary. Fixes issue #141.
* scanner: Remove incorrect c:type from fields with array typeTomasz Miąsko2019-01-062-14/+10
| | | | | | | | | | Neither `_create_source_type` nor `_create_complete_source_type` actually support fixed size arrays, so previously generated C types were incorrect. Remove C types from array fields instead of producing incorrect ones. Fixes issue #145.
* meson: warn that not all tests will be run if building without cairo/doctoolChristoph Reiter2019-01-061-1/+1
|
* scanner: Merge specifiers and qualifiers when merging basic types.Tomasz Miąsko2019-01-051-1/+1
|
* scanner: Merge basic types in `specifier_qualifier_list` production.Tomasz Miąsko2019-01-058-185/+246
| | | | | | | | | | | This is necessary to parse types like `unsigned char` or `long double`, and is already done when parsing `declarations_specifiers`. Examples that are fixed by this change include: * `GLib.TestLogMsg.nums` previously parsed as `long` but should be `long double`. * `GMime.Encoding.uubuf` previously parsed as `unsigned` but should be `unsigned char`.
* autotools: dist test_docwriter.pyChristoph Reiter2019-01-041-1/+2
|
* meson: port doctool testsChristoph Reiter2019-01-031-0/+58
|
* tests: try building Bar-1.0 againChristoph Reiter2019-01-021-1/+36
| | | | This time pass the libgirepository build dir
* gimarshallingtests: Remove declarations of nonexistent functionsPhilip Chimento2019-01-011-8/+0
| | | | | | | These functions were removed a long time ago in commit af7be95a. Being present in the header file means they are present in the generated GIR file, but trying to resolve them with dlsym will fail and crash the program.
* meson: port more typelib testsChristoph Reiter2019-01-013-30/+138
|
* meson: make test_offsets.py work on WindowsChristoph Reiter2019-01-011-6/+7
| | | | | meson doesn't set PATH for the test dependencies so we have to do it manually. Also make sure the test depends on the test binary.
* gitestoffsets: use g_fprintf and fix the format specifier for the struct offsetChristoph Reiter2019-01-011-19/+20
| | | | | | | G_GSIZE_FORMAT should only be used with glib functions and G_STRUCT_OFFSET() returns glong not gsize. This fixes various compiler warnings on Windows.
* tests: add the utility dep to the right targetChristoph Reiter2019-01-011-2/+2
| | | | I added it to the wrong one in d2bd6390ed8, oops..
* tests: revert building Bar-1.0.girChristoph Reiter2019-01-011-26/+1
| | | | | It broke continuous https://build.gnome.org/continuous/buildmaster/builds/2019/01/01/0/build/log-gobject-introspection.txt
* meson: port more gir testsChristoph Reiter2019-01-011-0/+92
|