26 Commits

Author SHA1 Message Date
William Douglas e01b473251 Switch to clang-format as a github action
Instead of having this be a local test, have a format target for the
Makefile and use a github action for clang-format to avoid differences
between developer systems clang-format and runner clang-format
versions.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-04-25 14:44:10 -07:00
William Douglas 436fb503c6 Don't version clang-format
clang-format changing output between versions is painful so might need
to be reconsidered at some point.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-02-17 12:58:05 -08:00
William Douglas 7e00e0a20b Switch off of string n functions
These functions lead to spurious errors and warnings for our use
cases.

Signed-off-by: William Douglas <william.douglas@intel.com>
2022-10-07 12:51:05 -07:00
Otavio Pontes 5ff46653cf actions: Create another job to check for API changes
Create another github job to check if the API has been changed in this
PR, so it will be easier to notice that a broken test is just an API
broken test

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-14 10:45:46 -07:00
Otavio Pontes 07fb739c10 test: Add test to make sure we won't forget '\n' on log messages
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-12 12:26:09 -07:00
Otavio Pontes fc1f874c89 macros: Create wrapper for malloc and calloc functions
Use always calloc to allocate memory and abort on errors

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-06 09:54:24 -07:00
Otavio Pontes 076aeff0d0 target_root: Use run_commmand to execute tar|tar command
Porting code to better way on interacting with system commands using the
run_command function. As run_command don't support multi-thread for
performance reasons, we are now using a file instead of a pipe. As tar|tar
is now a fallback, this won't have any performance impacts on any case
where with no problems and errors.

Fixes #640 and #671

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-05 12:22:48 -07:00
Otavio Pontes 04eacb16be verifytime: Making verifytime completely independent again
We have added more dependencies in verifytime, but this was harder to
keep as it looks like, so making it completely independent from swupd
libs.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-05 12:14:54 -07:00
Otavio Pontes a3c1f97c57 shellcheck: Unify shellcheck script
Make sure shellcheck and shellcheck bats are using the same configuration to
run shellcheck

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-30 08:50:48 -07:00
Otavio Pontes 203b9e35ca macros: Create a wrapper for free()
On several points on swupd we need to free a pointer and then set it to
NULL. This is made in some areas using the free_and_clear_pointer(). But
most places free_and_clear_pointer() is used, this is not really necessary.

On the other hand it's hard to make sure that we are really setting to NULL
every pointer that we need, so we're adding a more conservative approach on
setting every pointer to NULL after free using a wrapper.

The greatest advantage of this wrapper over free_and_clear_pointer() is that
it's not type dependent and we don't need to call it with a pointer of a pointer,
so calls look more to calls to a standard free.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-29 10:20:50 -07:00
Otavio Pontes e15ee0a6d6 sys: Always prefer to use basename and dirname from sys.c
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-29 10:20:50 -07:00
Castulo Martinez b58e6c20ca Fail to be compliant if --quiet tests change
We are aiming to provide a stable --quiet output, so forcing "make
compliant" to fail if there are changes in the test/functional/api
tests, which cover these scenarios will prevent us from unadvertedly
changing those tests.

Closes #1501

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-28 14:19:57 -07:00
Otavio Pontes cac56264d3 compliant: Start using clang-format-10 to check for style problems
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-23 12:07:51 -07:00
Otavio Pontes 73a6d0055c strings: Create safer wrapper to strcmp()
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-23 08:55:45 -07:00
Otavio Pontes 6def37a640 tests: Add script to validate if we are using one function we want to avoid
There are some functions we decided to avoid using, so add a test to make
sure we won't add them by accident.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 12:17:54 -07:00
Otavio Pontes 82792caa71 shellcheck: Fix newly reported bash problems 2020-03-19 09:53:39 -07:00
Otavio Pontes 4eab2e54ad shellcheck: Don't stop shellcheck-all script on first error
This is script is very slow, so it's better to gather all information
before aborting.

Also improve the output of the test when an error happens
2020-03-19 09:53:39 -07:00
Otavio Pontes 50327fc9d3 Makefile: Change behavior of make check
Now make check is only running unit tests and a new target,
functional-check is used for bat tests. The major win on that
was that now we can use find to look for all bat tests in the
functional library and we don't need to keep the BATS list
updated.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-11-18 15:48:10 -08:00
Otavio Pontes 16e8f01254 compliant: Also check for whitespaces in headers
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-25 14:48:53 -07:00
Otavio Pontes a0cb9377f2 compliant: src/ directory was missing in compliant script
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-25 14:47:27 -07:00
Otavio Pontes 74868805ae compliant: Provide more information when clang-format-9 fails
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-15 15:24:36 -07:00
Otavio Pontes 0f90dbaf07 Fix new reported compliant issues
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-10 09:08:57 -07:00
Otavio Pontes 2827914675 compliant: enforce sorted list of files in Makefile.am
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-04 16:05:21 -07:00
Otavio Pontes bb1559ef6e compliant: Add check for trailing whitespaces on tests
Note that the clang-format already does this for the source code

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-04 16:05:21 -07:00
Otavio Pontes 18978eed70 Makefile: Move code style check to a bats script
Just moving code from Makefile to a bats script to be easier to extend the
code style check

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-04 16:05:21 -07:00
Otavio Pontes e148456c8a test: Shellcheck tests should return an error on fails
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-12 16:32:18 -07:00