[OpenWrt-Devel] [PATCH uci 00/18] fixes and improvements

Petr Štetiar ynezz at true.cz
Mon Nov 4 19:36:39 EST 2019


Hi,

while working on possible test case for CVE-2019-15513, I've made uci compile
with -Wextra flags (needs Hauke's PW#1188122[1] patch), tried to make
clang/cppcheck static code analyzers happy, fixed some memleaks in Lua module,
integrated shunit2 tests in CMake and run them under valgrind by default,
added few Lua tests under cram as well.

1. https://patchwork.ozlabs.org/patch/1188122/

Petr Štetiar (18):
  test: move shunit2 tests under standalone subdirectory
  cmake: add unit testing option and shunit2 tests
  tests: shunit2: make it working under CMake
  add initial GitLab CI support
  tests: shunit2: fix issues reported by shellcheck
  cmake: build Lua module only if enabled
  cmake: enable extra compiler checks
  tests: shunit2: run all tests under Valgrind by default
  iron out all extra compiler warnings
  cli: fix realloc issue spotted by cppcheck
  lua: fix copy&paste in error string
  tests: add cram based unit tests
  lua: fix memory leak in changes method
  lua: fix memory leak in set method
  cli: remove unused variable assigment
  delta: prevent possible null pointer use
  ucimap: fix possible use of memory after it is freed
  lua: fix error handling

 .gitignore                                    |  5 +-
 .gitlab-ci.yml                                |  8 +++
 CMakeLists.txt                                | 12 +++-
 cli.c                                         | 12 +++-
 delta.c                                       |  3 +-
 file.c                                        |  5 +-
 list.c                                        |  4 +-
 lua/CMakeLists.txt                            | 34 +++++------
 lua/uci.c                                     | 45 +++++++-------
 parse.c                                       |  2 +
 tests/CMakeLists.txt                          |  2 +
 tests/cram/CMakeLists.txt                     | 21 +++++++
 tests/cram/config/network                     | 25 ++++++++
 tests/cram/lua/basic.lua                      | 44 ++++++++++++++
 .../lua/test_cases/changes_doesnt_leak.lua    | 11 ++++
 .../set_with_empty_table_doesnt_leak.lua      |  2 +
 tests/cram/test_ucilua.t                      | 58 +++++++++++++++++++
 tests/cram/test_ucilua_testcases.t            | 17 ++++++
 tests/shunit2/CMakeLists.txt                  |  7 +++
 {test => tests/shunit2}/Makefile              |  0
 {test => tests/shunit2}/README                |  0
 {test => tests/shunit2}/config/network        |  0
 .../references/add_list_changes.result        |  0
 .../references/add_list_config.result         |  0
 .../shunit2}/references/add_list_show.result  |  0
 .../shunit2}/references/add_section.result    |  0
 .../shunit2}/references/batch_comments.result |  0
 .../shunit2}/references/batch_set.result      |  0
 .../cli.options.delta.commit.result           |  0
 .../cli.options.delta.export.result           |  0
 .../references/del_list_config.result         |  0
 .../del_list_multiline_config.result          |  0
 .../shunit2}/references/export.data           |  0
 .../shunit2}/references/export.result         |  0
 {test => tests/shunit2}/references/get.data   |  0
 .../shunit2}/references/get_multiline.data    |  0
 .../shunit2}/references/get_parsing.data      |  0
 .../shunit2}/references/import.data           |  0
 .../shunit2}/references/import.result         |  0
 .../shunit2}/references/revert_option.result  |  0
 .../references/revert_option_multiline.result |  0
 .../shunit2}/references/revert_section.result |  0
 .../references/set_existing_option.data       |  0
 .../references/set_existing_option.result     |  0
 .../set_existing_option_multiline.result      |  0
 .../references/set_named_section.result       |  0
 .../references/set_nonexisting_option.data    |  0
 .../references/set_nonexisting_option.result  |  0
 .../set_nonexisting_option_multiline.result   |  0
 .../shunit2}/references/set_parsing.data      |  0
 .../references/set_parsing_multiline.data     |  0
 .../shunit2}/references/show_parsing.data     |  0
 .../references/show_parsing_multiline.data    |  0
 .../show_parsing_multiline_option.result      |  0
 .../show_parsing_multiline_package.result     |  0
 .../show_parsing_multiline_section.result     |  0
 .../references/ucimap_example_1.result        |  0
 .../references/ucimap_example_2.result        |  0
 {test => tests/shunit2}/shunit2/shunit2       |  0
 {test => tests/shunit2}/tests.d/000_import    |  0
 {test => tests/shunit2}/tests.d/010_export    |  0
 {test => tests/shunit2}/tests.d/020_get       |  0
 {test => tests/shunit2}/tests.d/030_set       |  0
 {test => tests/shunit2}/tests.d/040_add       |  0
 {test => tests/shunit2}/tests.d/050_show      |  0
 {test => tests/shunit2}/tests.d/060_batch     |  0
 {test => tests/shunit2}/tests.d/070_revert    |  0
 {test => tests/shunit2}/tests.d/080_list      |  0
 .../shunit2}/tests.d/090_cli_options          |  0
 {test => tests/shunit2}/tests.d/100_changes   |  0
 {test => tests/shunit2}/tests.sh              | 10 ++--
 ucimap.c                                      | 30 ++++++----
 72 files changed, 291 insertions(+), 66 deletions(-)
 create mode 100644 .gitlab-ci.yml
 create mode 100644 tests/CMakeLists.txt
 create mode 100644 tests/cram/CMakeLists.txt
 create mode 100644 tests/cram/config/network
 create mode 100644 tests/cram/lua/basic.lua
 create mode 100644 tests/cram/lua/test_cases/changes_doesnt_leak.lua
 create mode 100644 tests/cram/lua/test_cases/set_with_empty_table_doesnt_leak.lua
 create mode 100644 tests/cram/test_ucilua.t
 create mode 100644 tests/cram/test_ucilua_testcases.t
 create mode 100644 tests/shunit2/CMakeLists.txt
 rename {test => tests/shunit2}/Makefile (100%)
 rename {test => tests/shunit2}/README (100%)
 rename {test => tests/shunit2}/config/network (100%)
 rename {test => tests/shunit2}/references/add_list_changes.result (100%)
 rename {test => tests/shunit2}/references/add_list_config.result (100%)
 rename {test => tests/shunit2}/references/add_list_show.result (100%)
 rename {test => tests/shunit2}/references/add_section.result (100%)
 rename {test => tests/shunit2}/references/batch_comments.result (100%)
 rename {test => tests/shunit2}/references/batch_set.result (100%)
 rename {test => tests/shunit2}/references/cli.options.delta.commit.result (100%)
 rename {test => tests/shunit2}/references/cli.options.delta.export.result (100%)
 rename {test => tests/shunit2}/references/del_list_config.result (100%)
 rename {test => tests/shunit2}/references/del_list_multiline_config.result (100%)
 rename {test => tests/shunit2}/references/export.data (100%)
 rename {test => tests/shunit2}/references/export.result (100%)
 rename {test => tests/shunit2}/references/get.data (100%)
 rename {test => tests/shunit2}/references/get_multiline.data (100%)
 rename {test => tests/shunit2}/references/get_parsing.data (100%)
 rename {test => tests/shunit2}/references/import.data (100%)
 rename {test => tests/shunit2}/references/import.result (100%)
 rename {test => tests/shunit2}/references/revert_option.result (100%)
 rename {test => tests/shunit2}/references/revert_option_multiline.result (100%)
 rename {test => tests/shunit2}/references/revert_section.result (100%)
 rename {test => tests/shunit2}/references/set_existing_option.data (100%)
 rename {test => tests/shunit2}/references/set_existing_option.result (100%)
 rename {test => tests/shunit2}/references/set_existing_option_multiline.result (100%)
 rename {test => tests/shunit2}/references/set_named_section.result (100%)
 rename {test => tests/shunit2}/references/set_nonexisting_option.data (100%)
 rename {test => tests/shunit2}/references/set_nonexisting_option.result (100%)
 rename {test => tests/shunit2}/references/set_nonexisting_option_multiline.result (100%)
 rename {test => tests/shunit2}/references/set_parsing.data (100%)
 rename {test => tests/shunit2}/references/set_parsing_multiline.data (100%)
 rename {test => tests/shunit2}/references/show_parsing.data (100%)
 rename {test => tests/shunit2}/references/show_parsing_multiline.data (100%)
 rename {test => tests/shunit2}/references/show_parsing_multiline_option.result (100%)
 rename {test => tests/shunit2}/references/show_parsing_multiline_package.result (100%)
 rename {test => tests/shunit2}/references/show_parsing_multiline_section.result (100%)
 rename {test => tests/shunit2}/references/ucimap_example_1.result (100%)
 rename {test => tests/shunit2}/references/ucimap_example_2.result (100%)
 rename {test => tests/shunit2}/shunit2/shunit2 (100%)
 rename {test => tests/shunit2}/tests.d/000_import (100%)
 rename {test => tests/shunit2}/tests.d/010_export (100%)
 rename {test => tests/shunit2}/tests.d/020_get (100%)
 rename {test => tests/shunit2}/tests.d/030_set (100%)
 rename {test => tests/shunit2}/tests.d/040_add (100%)
 rename {test => tests/shunit2}/tests.d/050_show (100%)
 rename {test => tests/shunit2}/tests.d/060_batch (100%)
 rename {test => tests/shunit2}/tests.d/070_revert (100%)
 rename {test => tests/shunit2}/tests.d/080_list (100%)
 rename {test => tests/shunit2}/tests.d/090_cli_options (100%)
 rename {test => tests/shunit2}/tests.d/100_changes (100%)
 rename {test => tests/shunit2}/tests.sh (85%)
 mode change 100644 => 100755


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list