summaryrefslogtreecommitdiff
path: root/src/tests/eina
Commit message (Collapse)AuthorAgeFilesLines
* eina_tests: Fix argument cannot be negativeChristopher Michael2021-02-241-2/+2
| | | | | | | | | | | Coverity reports that 'fd' returned from 'open' here returns a negative number. Passing a negative number to the 'write' function is not allowed, so we should change the 'fail_if' checks here to make sure 'fd' is not negative. Fixes CID1400940 @fix
* eina: Rename EAPI macro to EINA_API in Eina libraryFelipe Magno de Almeida2020-11-252-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Patch from a series of patches to rename EAPI symbols to specific library DSOs. EAPI was designed to be able to pass `__attribute__ ((visibility ("default")))` for symbols with GCC, which would mean that even if -fvisibility=hidden was used when compiling the library, the needed symbols would get exported. MSVC __almost__ works like GCC (or mingw) in which you can declare everything as export and it will just work (slower, but it will work). But there's a caveat: global variables will not work the same way for MSVC, but works for mingw and GCC. For global variables (as opposed to functions), MSVC requires correct DSO visibility for MSVC: instead of declaring a symbol as export for everything, you need to declare it as import when importing from another DSO and export when defining it locally. With current EAPI definitions, we get the following example working in mingw and MSVC (observe it doesn't define any global variables as exported symbols). Example 1: dll1: ``` EAPI void foo(void); EAPI void bar() { foo(); } ``` dll2: ``` EAPI void foo() { printf ("foo\n"); } ``` This works fine with API defined as __declspec(dllexport) in both cases and for gcc defining as `__atttribute__((visibility("default")))` However, the following: Example 2: dll1: ``` EAPI extern int foo; EAPI void foobar(void); EAPI void bar() { foo = 5; foobar(); } ``` dll2: ``` EAPI int foo = 0; EAPI void foobar() { printf ("foo %d\n", foo); } ``` This will work on mingw but will not work for MSVC. And that's why EAPI is the only solution that worked for MSVC. Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com> Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev> Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com> Reviewers: jptiz, lucas, woohyun, vtorri, raster Reviewed By: jptiz, lucas, vtorri Subscribers: ProhtMeyhet, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12188
* singularize srand in eina_init - only once in one placeCarsten Haitzler (Rasterman)2020-10-032-12/+0
| | | | | | simplify down to having a single srand() in eina_init and use urandom if it works and is there - if not, time(NULL) will do. it's the best we can...
* eina file test: check rmdir result.Vincent Torri2020-09-021-1/+1
| | | | | | | Fix CID 1432267 Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D12125
* eina: Replace remove with rmdir and delete tmpstrJoão Paulo Taylor Ienczak Zanette2020-08-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although the [remove manpage](https://linux.die.net/man/3/remove) states that `remove(...)` deletes either a file or a directory, this is not true in Windows as it can be seen in [MSDN docs for remove](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/remove-wremove?view=vs-2019): > **(Function description)** > > Delete a file. > > **Return Value** > > Each of these functions returns 0 if the file is successfully deleted. > Otherwise, **it returns -1 and sets errno either to EACCES to indicate that the > path** specifies a read-only file, //**specifies a directory**//, or the file > is open, or to ENOENT to indicate that the filename or path was not found. This implementation detail caused the Eina test to fail and not removing the temporary directory. This patch changes the use of `remove` to the directory-specific `rmdir`, which is guaranteed to remove the directory. Additionally, it also deletes the Eina_TmpStr that holds the temporary directory path. Reviewed-by: Vincent Torri <vincent.torri@gmail.com> Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D12115
* eina_test_lock.c: Implement clock_gettime for WindowsWander Lairson Costa2020-08-201-0/+19
| | | | | | Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Reviewed-by: Vincent Torri <vincent.torri@gmail.com> Differential Revision: https://phab.enlightenment.org/D12023
* eina: Close file in unlink testJoão Paulo Taylor Ienczak Zanette2020-08-201-1/+6
| | | | | | | | | | | | | | | | | At least on Windows (didn't have the time to test on Linux yet), running tests, even if they passed, there would be an Eina error on logs pointing that a temporary file wasn't closed: ``` ERR:eina_file ../src/lib/eina/eina_file_common.c:1137 eina_file_shutdown() File [C:/Users/joao_/AppData/Local/Temp/aaaa_file_test_EBpVea] still open 1 times ! ``` In the end, it was the `eina_file_test_unlink` that would create a temporary file but never close it, being caught only by `eina_shutdown()`. Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Reviewed-by: Vincent Torri <vincent.torri@gmail.com> Differential Revision: https://phab.enlightenment.org/D12062
* windows: Fix path for file sanitizationWander Lairson Costa2020-07-061-1/+6
| | | | | | | | | | | | | | | ``` > c:\ > cd /windows ``` Are valid paths. Paths starting with '\' or '/' should be considered absolute paths. Reviewed-by: Vincent Torri <vincent.torri@gmail.com> Reviewed-by: João Paulo Taylor Ienczak Zanette <joao.tiz@expertisesolutions.com.br> Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D12022
* Fix eina file thread test on WindowsWander Lairson Costa2020-06-261-1/+23
| | | | | | | | | | | | On windows, we try to open the "cmd.exe" file, but without the full path the test fails unless it runs from the system directory. We now use the full path to test the eina_file_open function. Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Reviewed-by: Vincent Torri <vincent.torri@gmail.com> Reviewed-by: João Paulo Taylor Ienczak Zanette <joao.tiz@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D12021
* eina_test_file.c: Do not test errno if the function doesn't failWander Lairson Costa2020-06-231-6/+2
| | | | | | | | | errno only holds a valid value if the function returns an error. ref: windows-native-port Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D11971
* eina_strbuf: introduce change last occurrence functionAli Alzyod2020-06-221-1/+5
| | | | | | | | | | | | | | Reviewers: cedric, woohyun, bowonryu Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8757 Differential Revision: https://phab.enlightenment.org/D11990
* eina_strbuf: resolve segfault when replace used with read_only bufferAli Alzyod2020-06-221-0/+10
| | | | | | | | | | | | | | | | Summary: when eina_strbuf_replace is used by read_only buffer, this will cause segfault (access invalid memory) Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8757 Differential Revision: https://phab.enlightenment.org/D11989
* tests: eina: fix ENOMEM message on Windows and solarisVincent Torri2020-06-181-0/+4
| | | | | | | | On Windows and solaris the string associated to ENOMEM is "Not enough space" Reviewed-by: João Paulo Taylor Ienczak Zanette <joao.tiz@expertisesolutions.com.br> Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D11983
* tests: eina: make sure we always check on eina_matrixsparse_data_idx_get returnStefan Schmidt2020-06-101-0/+2
| | | | | | | | | | It has been checked in all other places, but has been forgotten in these two. CID: 1401081 Reviewed-by: Christopher Michael <devilhorns@comcast.net> Differential Revision: https://phab.enlightenment.org/D11960
* tests: eina: also handle failure cases when cleaning up created files/foldersStefan Schmidt2020-06-101-3/+3
| | | | | | | | | | Somethign fishy is going on if we can not delete the files and folders we created. CID: 1400986 Reviewed-by: Christopher Michael <devilhorns@comcast.net> Differential Revision: https://phab.enlightenment.org/D11955
* tests: eina: check return of eina_module_load and unloadStefan Schmidt2020-06-101-2/+2
| | | | | | | | | These could fail as well. Check in testsuite. CID: 1400961 Reviewed-by: Christopher Michael <devilhorns@comcast.net> Differential Revision: https://phab.enlightenment.org/D11959
* Eina file test: use the correct Eina file objectVincent Torri2020-05-271-1/+1
| | | | | | Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D11885
* Eina file test: on Windows, open cmd, not a shellVincent Torri2020-05-271-1/+6
| | | | | | Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D11884
* tests: eina: fix usage of long on WindowsVincent Torri2020-05-191-9/+9
| | | | | | | | On Windows 64bits, long is a 4 bytes type. Declare i as being a uintptr_t instead of unsigned long Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D11837
* tests: resolve float comparison warningsMike Blumenkrantz2020-05-093-71/+71
| | | | | | | | | | Summary: Depends on D11788 Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11789
* Use __func__ C99 identifier instead of __FUNCTION__ compiler extensionVincent Torri2020-05-072-6/+6
| | | | | | | | | | | | | | Summary: see http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1124.pdf section 6.4.2.2 page 52 Test Plan: compilation Reviewers: raster, devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11785
* eina_content: free eina content in the test:Marcel Hollerbach2020-04-171-0/+1
| | | | Fix the unbelievable High prioritized CID 1420314
* eina_content: fix use after free in test codeMarcel Hollerbach2020-03-091-2/+2
|
* eina: introduce Eina_Abstract_ContentMarcel Hollerbach2020-03-084-1/+227
| | | | | | | | A little abstraction to have abstract data content bound to a type. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es> Differential Revision: https://phab.enlightenment.org/D11018
* eina: introduce eina_iterator_processMarcel Hollerbach2020-02-191-0/+44
| | | | | | | | this brings a functional-map function to the iterator implementations. https://en.wikipedia.org/wiki/Map_(higher-order_function) Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D11062
* eina-suite: do not print that many errorsMarcel Hollerbach2020-02-144-16/+45
| | | | | | | | we should expect errors in these conditions, this also safes a lot of space in logs. Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D11296
* efl: `eina_value_list_vinsert` assumes that the position is always validLucas Cavalcante de Sousa2020-02-071-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The eina_value_list_vinsert at src/lib/eina_inline_value.x was not checking if the desired position was valid: When inserting in an empty list in any out of bounds position it actually createded a list with the head being the desired value. When inserting in a non-empty list in an out of bounds position caused a c error. Now both cases return EINA_FALSE Ref T8611 Test Plan: Meson configured with -Dbindings=mono,cxx -Dmono-beta=true, and tests runned with ninja test all. Reviewers: felipealmeida, zmike Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8611 Differential Revision: https://phab.enlightenment.org/D11301
* eina_matrix: Add eina_matrix4 operator(translate, rotate, scale)JunsuChoi2020-01-291-0/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add an operator related to the 3D transform in eina_matrix. enum eina_matrix_axis EINA_MATRIX_AXIS_X EINA_MATRIX_AXIS_Y EINA_MATRIX_AXIS_Z eina_matrix4_translate eina_matrix4_scale eina_matrix4_rotate eina_matrix4_transpose Test Plan: src/tests/eina/eina_test_matrix.c Reviewers: Hermet, bu5hm4n, kimcinoo, segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11159
* eina: add new range Data typeali2020-01-234-0/+75
| | | | | | | | | | | | | | | | | | | | | | | Summary: Introduce new data type (Eina.Range) which represent range (part of series) **eina_range_max_get** **eina_range_intersect** **eina_range_union** **eina_range_contains** **eina_range_equal** Reviewers: cedric, woohyun, bu5hm4n, segfaultxavi, zmike Reviewed By: woohyun Subscribers: vtorri, cedric, #committers, #reviewers Tags: #efl Maniphest Tasks: T8570 Differential Revision: https://phab.enlightenment.org/D11133
* eina_accessor: make carray accessor work properlyMarcel Hollerbach2019-12-181-1/+31
| | | | | | | | | | | | | | | | | | a accessor is not really helpfull if it operates like the carray accessor before this commit. What it was doing is to fill the content of the "current line" into the data pointer. In a carray the "current line" is the content of its carray-member. However, accessors like for inarray array list or inlist do work completly differently. They are returning the pointer to the "current line" not the value of the current line. The only case where this worked is efl_ui_format.c which was only tested with this accessor, and this accessor also only worked with this accessor. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10908
* eina_matrix: replace cosf by cos to gain more accuracyWonki Kim2019-11-211-2/+2
| | | | | | | | | | | | | | Summary: cos function is much much more accurate than cosf. this patch replaces cosf by cos to gain more accuracy. Reviewers: cedric, jsuya, vtorri Subscribers: vtorri, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10695
* Eina_Matrix : Use math header for cosf and sinf of rotate function.JunsuChoi2019-11-151-7/+7
| | | | | | | | | | The local cos and sin functions differ from the math header cos and sin functions by result values The 4th decimal place is different. Computing large numbers can cause errors. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10467
* tests/eina: use #ifdef guard for block which can only occur inside ifdefMike Blumenkrantz2019-10-311-2/+2
| | | | | | | | | | this value is set in the corresponding #ifdef block above, so use the same guard here to make code more readable CID 1400948 Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10321
* tests/eina: use slstr_steal function in slstr_steal testMike Blumenkrantz2019-10-241-1/+1
| | | | | | | | | | | | | | Summary: CID 1401043 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10404
* fix various trivial null derefsMike Blumenkrantz2019-10-181-0/+1
| | | | | | | | | | | | | | | | Summary: CIDs 1401081, 1401044, 1400983, 1400960, 1400927, 1400799, 1396946, 1396944, 1383851, 1383847, 1382211, 1379921, 1379921 Reviewers: cedric Reviewed By: cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10452
* tests: fix minor string leaksMike Blumenkrantz2019-10-181-0/+1
| | | | | | | | | | | | | | Summary: CIDs 1404754, 1401022, 1400965 Reviewers: devilhorns Reviewed By: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10405
* tests/eina: fix assign when compare was intendedMike Blumenkrantz2019-10-151-1/+1
| | | | | | | | | | | | | | Summary: CID 1400858 Reviewers: lauromoura Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10396
* tests/eina: outdent codeMike Blumenkrantz2019-09-261-3/+3
| | | | | | | | | | | | | | | | | | Summary: this is a very important coverity issue. CID 1400838 Depends on D10205 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10206
* tests/strbuf: call va_end for varargsMike Blumenkrantz2019-09-261-0/+1
| | | | | | | | | | | | | | Summary: CID 1400792 Reviewers: brunobelo Reviewed By: brunobelo Subscribers: brunobelo, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10204
* eina: add eina_mempool_iterator_new to slowly iterate every allocated ↵Cedric Bail2019-09-191-1/+17
| | | | | | | pointer in a mempool. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9941
* eina: turn on Eina_Mempool tests for OneBig too.Cedric Bail2019-09-171-0/+14
| | | | | Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9940
* eina_test: resolve build warningAli Alzyod2019-08-291-1/+1
| | | | Differential Revision: https://phab.enlightenment.org/D9781
* eina/array: added eina_array_find() api to eina_array.sub.mohanty@samsung.com2019-08-261-0/+29
| | | | | | | | | | | | | | Summary: updated test suite for testing the api. Reviewers: zmike, Hermet, cedric, segfaultxavi Reviewed By: zmike, segfaultxavi Subscribers: segfaultxavi, ProhtMeyhet, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9734
* Evil: remove pwd code in Evil and fix compilation failures after the removalVincent Torri2019-07-281-1/+3
| | | | | | | | | | | | | | Summary: remove pwd code in Evil Test Plan: compilation Reviewers: zmike, cedric, raster Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9420
* eina: add accessors for c arraysMarcel Hollerbach2019-07-031-0/+28
| | | | This adds a new API which can be used to get access to a carray via the eina_accessor API.
* remove last bits of Evil.h in tests and use evil_private.h insteadVincent Torri2019-06-241-1/+1
| | | | | | | | | | | | | | Test Plan: compilation Reviewers: zmike, raster, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9154
* tests: fix warnings and undef ref on Windows (using meson :-) )Vincent Torri2019-06-201-2/+5
| | | | | | | | | | | | | | Summary: we need to include evil_private.h so that some symbols are declared Test Plan: compilation Reviewers: raster, zmike, cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9129
* eina: add test for eina_slstr_copy_new_length.Cedric BAIL2019-05-291-0/+31
| | | | | | | | | | | | | | | | Summary: Depends on D8800 Reviewers: zmike Reviewed By: zmike Subscribers: zmike, #reviewers, #committers Tags: #efl Maniphest Tasks: T7832 Differential Revision: https://phab.enlightenment.org/D9016
* meson: enforce 61s timeout for tests, remove explicit timeouts from build filesMike Blumenkrantz2019-05-151-1/+0
| | | | | | | | | | unit tests automatically abort with info after 60s, and tests should be run with an appropriate timeout to avoid conflict with the test runner's default 30s timeout set explicit timeout in eio test for now because there's still frequent bugs here Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D8894
* Revert "remove vpath test for user dir the test was broken and fixing is insane"Marcel Hollerbach2019-05-151-0/+17
| | | | | | | | | | | | | | | | | | | | | | Summary: This reverts commit 954a534bc0e7f30e66cc7dfd15ac79544e92671f. It appears that the concerns from this commit are invalid. The case of ~asdf/ does not have any fallback case, if there is no getpwent on this system, then there will be simply an error, same for the case of a missing user. In such a case nothing will be written in the buffer / returned by eina_vpath. The windows build problem can be fixed by a simple #ifdef'ing the test code. Reviewers: raster, zmike, cedric, vtorri Reviewed By: vtorri Subscribers: vtorri, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8671