[OpenSIPS-Devel] [OpenSIPS/opensips] 2d3c07: Add a basic unit testing framework

Liviu Chircu liviu at opensips.org
Wed Feb 28 12:53:41 EST 2018


  Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 2d3c0733db83b5b70f092a1337bbe11c268d47a4
      https://github.com/OpenSIPS/opensips/commit/2d3c0733db83b5b70f092a1337bbe11c268d47a4
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-14 (Wed, 14 Feb 2018)

  Changed paths:
    M Makefile
    M Makefile.conf.template
    M Makefile.defs
    A Makefile.test
    A cachedb/test/test_backends.c
    A cachedb/test/test_backends.h
    M globals.h
    M main.c
    M net/trans.c
    M sr_module.c
    M str.h
    A test/unit_tests.c
    A test/unit_tests.h

  Log Message:
  -----------
  Add a basic unit testing framework

Currently, this framework only supports writing unit tests for core
code, but there are plans to expand it such that module tests can be
easily written as well.

The chosen C unit testing framework is libtap
(https://github.com/zorgnax/libtap) - very lightweight and full of goodies.

In order to write a core unit test, you should write the test file
under a "test/" dir which resides right next to the tested file. The
build system is smart enough to link any such test files placed in
random test dirs all across the core codebase. Next, you enrol your
test file to be init'ed and run in test/unit_tests.c, and you're done.

To run the entire unit testing suite, just do "make test". You will
have to type this command twice if you haven't enabled "-DUNIT_TESTS"
under Makefile.conf beforehand.


  Commit: b3ef9c18956e8801181d9f7a45edadded9aea444
      https://github.com/OpenSIPS/opensips/commit/b3ef9c18956e8801181d9f7a45edadded9aea444
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-14 (Wed, 14 Feb 2018)

  Changed paths:
    M cfg.y
    M sr_module.c
    M sr_module.h
    M test/unit_tests.c

  Log Message:
  -----------
  core: Refactor the mpath-related code into a function


  Commit: 0a08c9e16fe5d939c01136b0a4e9c279f8838d5e
      https://github.com/OpenSIPS/opensips/commit/0a08c9e16fe5d939c01136b0a4e9c279f8838d5e
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-14 (Wed, 14 Feb 2018)

  Changed paths:
    M cachedb/cachedb.h
    M cachedb/cachedb_cap.h
    A cachedb/cachedb_dtype.h

  Log Message:
  -----------
  cachedb: Extend the headerfiles with dict-aware prototypes


  Commit: 56e8eb3ea8c2756c82e932bfb88a218059fcebbf
      https://github.com/OpenSIPS/opensips/commit/56e8eb3ea8c2756c82e932bfb88a218059fcebbf
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-15 (Thu, 15 Feb 2018)

  Changed paths:
    M cachedb/test/test_backends.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c

  Log Message:
  -----------
  cachedb_mongodb: Properly return "key not found" retcode


  Commit: 90b1840de0648ca0a7223d74e540e6872da86b2d
      https://github.com/OpenSIPS/opensips/commit/90b1840de0648ca0a7223d74e540e6872da86b2d
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-22 (Thu, 22 Feb 2018)

  Changed paths:
    M str.h
    M ut.h

  Log Message:
  -----------
  core utils: Useful additions

    * str_cpy() - similar to strcpy(), but works with strs
    * macros for working with singly linked lists


  Commit: 3efcb9b2859ec03dc017462ffe97d0848feb65af
      https://github.com/OpenSIPS/opensips/commit/3efcb9b2859ec03dc017462ffe97d0848feb65af
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-22 (Thu, 22 Feb 2018)

  Changed paths:
    M action.c
    R cachedb/cachedb_dtype.h
    A cachedb/cachedb_types.c
    A cachedb/cachedb_types.h
    M modules/cachedb_redis/cachedb_redis_dbase.c

  Log Message:
  -----------
  cachedb: Refactor the core data abstractions


  Commit: acf1afd4f7d820627ba9f3399475687380cb9ca8
      https://github.com/OpenSIPS/opensips/commit/acf1afd4f7d820627ba9f3399475687380cb9ca8
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-22 (Thu, 22 Feb 2018)

  Changed paths:
    M cachedb/cachedb.c
    M cachedb/cachedb.h

  Log Message:
  -----------
  cachedb: Add a filter management API


  Commit: 8b70ec3b9777e3d53cb49be8309a46aa6d21afdd
      https://github.com/OpenSIPS/opensips/commit/8b70ec3b9777e3d53cb49be8309a46aa6d21afdd
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-22 (Thu, 22 Feb 2018)

  Changed paths:
    M modules/cachedb_mongodb/cachedb_mongodb.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.h

  Log Message:
  -----------
  cachedb_mongodb: Implement the GET_ROWS capability


  Commit: 5481bc3f88bc62e268d8e90d60ce0c481911cd5e
      https://github.com/OpenSIPS/opensips/commit/5481bc3f88bc62e268d8e90d60ce0c481911cd5e
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-22 (Thu, 22 Feb 2018)

  Changed paths:
    M Makefile.test
    M cachedb/test/test_backends.c

  Log Message:
  -----------
  cachedb: Add a unit testing suite for the GET_ROWS capability


  Commit: d95187a8de6d16010c42a2d281990c56d4f8f8ac
      https://github.com/OpenSIPS/opensips/commit/d95187a8de6d16010c42a2d281990c56d4f8f8ac
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-22 (Thu, 22 Feb 2018)

  Changed paths:
    M cachedb/test/test_backends.c

  Log Message:
  -----------
  cachedb: Add unit tests for multi-filtering


  Commit: 5d0839cf81d8561ba2d943abe063c4ee304b6b5a
      https://github.com/OpenSIPS/opensips/commit/5d0839cf81d8561ba2d943abe063c4ee304b6b5a
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-22 (Thu, 22 Feb 2018)

  Changed paths:
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.h

  Log Message:
  -----------
  cachedb_mongodb: Fix a filtering operator bug


  Commit: 88ff10d45488d54f02932500ac2f98dbf62c3f6f
      https://github.com/OpenSIPS/opensips/commit/88ff10d45488d54f02932500ac2f98dbf62c3f6f
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-23 (Fri, 23 Feb 2018)

  Changed paths:
    M cachedb/cachedb.c
    M cachedb/cachedb.h
    M cachedb/cachedb_types.h
    M cachedb/test/test_backends.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.h

  Log Message:
  -----------
  cachedb: Refactor the multi-set/multi-unset API

    * add support for primary keys (e.g. to fit with MongoDB)
    * add support for map-level TTLs (to exploit Cassandra's powerful TTLs)


  Commit: 7c7ea7c64b846df59398b7c66076ccf5d7e35f66
      https://github.com/OpenSIPS/opensips/commit/7c7ea7c64b846df59398b7c66076ccf5d7e35f66
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-23 (Fri, 23 Feb 2018)

  Changed paths:
    M cachedb/cachedb_types.c

  Log Message:
  -----------
  cachedb: Fix memleak


  Commit: 73e4f1423dd0727ea42358ba1f15a0b6f44a46b2
      https://github.com/OpenSIPS/opensips/commit/73e4f1423dd0727ea42358ba1f15a0b6f44a46b2
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-26 (Mon, 26 Feb 2018)

  Changed paths:
    M cachedb/cachedb.h
    M cachedb/cachedb_cap.h
    M cachedb/test/test_backends.c
    M modules/cachedb_couchbase/cachedb_couchbase.c
    M modules/cachedb_local/cachedb_local.c
    M modules/cachedb_memcached/cachedb_memcached.c
    M modules/cachedb_sql/cachedb_sql.c

  Log Message:
  -----------
  cachedb: Add the "truncate" capability


  Commit: 458690a87df50c5076a5e6f46f397f7bbdf8f1eb
      https://github.com/OpenSIPS/opensips/commit/458690a87df50c5076a5e6f46f397f7bbdf8f1eb
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-26 (Mon, 26 Feb 2018)

  Changed paths:
    M modules/cachedb_mongodb/cachedb_mongodb.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.h

  Log Message:
  -----------
  cachedb_mongodb: Implement the "truncate" capability


  Commit: 34dd480d0652ba1e1ae60317937047cc8b9e3082
      https://github.com/OpenSIPS/opensips/commit/34dd480d0652ba1e1ae60317937047cc8b9e3082
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-26 (Mon, 26 Feb 2018)

  Changed paths:
    M cachedb/cachedb.h
    M cachedb/cachedb_types.h
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.h
    M str.h

  Log Message:
  -----------
  cachedb: Add object management primitives

i.e. for "cdb_kv_t" and "cdb_dict_t" objects


  Commit: 612c8d8faba03d5cad63bd3cf92dcd4c71f836c9
      https://github.com/OpenSIPS/opensips/commit/612c8d8faba03d5cad63bd3cf92dcd4c71f836c9
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-26 (Mon, 26 Feb 2018)

  Changed paths:
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c

  Log Message:
  -----------
  cachedb_mongodb: Improve filter construction

For single filters, avoid using the $and operator


  Commit: 816db4ff599f88539e7cb2d2c46901b4f2082b05
      https://github.com/OpenSIPS/opensips/commit/816db4ff599f88539e7cb2d2c46901b4f2082b05
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-26 (Mon, 26 Feb 2018)

  Changed paths:
    M cachedb/cachedb_types.c
    M cachedb/cachedb_types.h
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c

  Log Message:
  -----------
  cachedb_mongodb: Add useful debugging macros


  Commit: d683ae8d501abb9749ef46682e5de12d46105765
      https://github.com/OpenSIPS/opensips/commit/d683ae8d501abb9749ef46682e5de12d46105765
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-26 (Mon, 26 Feb 2018)

  Changed paths:
    M cachedb/cachedb_types.h
    M cachedb/test/test_backends.c

  Log Message:
  -----------
  cachedb: Add unit tests suite for "SET COLS" capability


  Commit: f402f6987d9aee9a7c6157e13715712490077cbe
      https://github.com/OpenSIPS/opensips/commit/f402f6987d9aee9a7c6157e13715712490077cbe
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-26 (Mon, 26 Feb 2018)

  Changed paths:
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c

  Log Message:
  -----------
  cachedb_mongodb: Implement the "SET COLS" capability


  Commit: d5a0462ec24bef478d25b1683cb89ce06b7dca19
      https://github.com/OpenSIPS/opensips/commit/d5a0462ec24bef478d25b1683cb89ce06b7dca19
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-27 (Tue, 27 Feb 2018)

  Changed paths:
    M cachedb/cachedb_types.c
    M cachedb/cachedb_types.h

  Log Message:
  -----------
  cachedb: Add dict debugging primitives


  Commit: 7045fce0b464a2b88455595795f849f8a8c51f8d
      https://github.com/OpenSIPS/opensips/commit/7045fce0b464a2b88455595795f849f8a8c51f8d
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-27 (Tue, 27 Feb 2018)

  Changed paths:
    M cachedb/cachedb_cap.h
    M cachedb/test/test_backends.c

  Log Message:
  -----------
  cachedb: Refactor and finalize the "set cols" tests


  Commit: 5ec432c7f7a8a82f85b03d5e4fd088016be61c96
      https://github.com/OpenSIPS/opensips/commit/5ec432c7f7a8a82f85b03d5e4fd088016be61c96
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-27 (Tue, 27 Feb 2018)

  Changed paths:
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c

  Log Message:
  -----------
  cachedb_mongodb: Fix missing primary key flag on "get rows"

Also do some minor clean-ups


  Commit: 2944ba83b8c30ebd26381307289b871718bfb415
      https://github.com/OpenSIPS/opensips/commit/2944ba83b8c30ebd26381307289b871718bfb415
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-27 (Tue, 27 Feb 2018)

  Changed paths:
    M ut.h

  Log Message:
  -----------
  ut.h: Remove redundant memset()


  Commit: b45c1bd83ad33912a3a3acacb48c60397b336f27
      https://github.com/OpenSIPS/opensips/commit/b45c1bd83ad33912a3a3acacb48c60397b336f27
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-28 (Wed, 28 Feb 2018)

  Changed paths:
    M cachedb/cachedb_cap.h

  Log Message:
  -----------
  cachedb: Fix cap detection


  Commit: ce54ac89db18ea134d8649215b783731cc988f91
      https://github.com/OpenSIPS/opensips/commit/ce54ac89db18ea134d8649215b783731cc988f91
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-28 (Wed, 28 Feb 2018)

  Changed paths:
    M cachedb/cachedb.h
    M cachedb/cachedb_cap.h
    M cachedb/cachedb_types.h
    M cachedb/test/test_backends.c
    M modules/cachedb_mongodb/cachedb_mongodb.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.h

  Log Message:
  -----------
  cachedb: Simplify the column-oriented API

Since some NoSQL backends support upsert-enabled "set" and "unset" operations
on multiple key/value pairs using a single query, we can merge the "set_cols()"
and "unset_cols()" functions into a single one: "update()". Current
backends known to support this are MongoDB and Cassandra.

Any backends which do not support the above will have to implement the update()
endpoint using two queries instead of one.


  Commit: c209ccbe0b7f967699a9bc5aa242ebf2564656e8
      https://github.com/OpenSIPS/opensips/commit/c209ccbe0b7f967699a9bc5aa242ebf2564656e8
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-28 (Wed, 28 Feb 2018)

  Changed paths:
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c

  Log Message:
  -----------
  cachedb_mongodb: Implement the multi-key "unset" API requirement


  Commit: d82b3ceaece4de09b12be44ebc0cfee426e494e9
      https://github.com/OpenSIPS/opensips/commit/d82b3ceaece4de09b12be44ebc0cfee426e494e9
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-28 (Wed, 28 Feb 2018)

  Changed paths:
    M cachedb/cachedb_types.h
    M cachedb/test/test_backends.c

  Log Message:
  -----------
  cachedb: Add unit tests for column "unset" operations


  Commit: 38975dfacba43e4005739480900febbda86baf36
      https://github.com/OpenSIPS/opensips/commit/38975dfacba43e4005739480900febbda86baf36
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-28 (Wed, 28 Feb 2018)

  Changed paths:
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c

  Log Message:
  -----------
  cachedb_mongodb: Enable multi-row updates


  Commit: 52dffcfcfe6f3b1c9e28883283625658ec0b82a1
      https://github.com/OpenSIPS/opensips/commit/52dffcfcfe6f3b1c9e28883283625658ec0b82a1
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-28 (Wed, 28 Feb 2018)

  Changed paths:
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c

  Log Message:
  -----------
  cachedb_mongodb: Fix last TODOs


  Commit: 89babc55ff6b638e2bc63f0d3cef3937681b5006
      https://github.com/OpenSIPS/opensips/commit/89babc55ff6b638e2bc63f0d3cef3937681b5006
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-28 (Wed, 28 Feb 2018)

  Changed paths:
    M cachedb/cachedb.c
    M cachedb/cachedb.h
    A cachedb/cachedb_dict.c
    A cachedb/cachedb_dict.h
    M cachedb/cachedb_types.c
    M cachedb/cachedb_types.h
    M cachedb/test/test_backends.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c

  Log Message:
  -----------
  cachedb: Final code refactoring

    * cdb_kv_t -> cdb_pair_t (more suggestive)
    * move all dict primitives to cachedb/cachedb_dict.[ch]
    * fix some coding style issues


  Commit: 784aa13118ebe0d458832db20ab0a4709dfcd5f0
      https://github.com/OpenSIPS/opensips/commit/784aa13118ebe0d458832db20ab0a4709dfcd5f0
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-02-28 (Wed, 28 Feb 2018)

  Changed paths:
    M Makefile
    M Makefile.conf.template
    M Makefile.defs
    A Makefile.test
    M action.c
    M cachedb/cachedb.c
    M cachedb/cachedb.h
    M cachedb/cachedb_cap.h
    A cachedb/cachedb_dict.c
    A cachedb/cachedb_dict.h
    A cachedb/cachedb_types.c
    A cachedb/cachedb_types.h
    A cachedb/test/test_backends.c
    A cachedb/test/test_backends.h
    M cfg.y
    M globals.h
    M main.c
    M modules/cachedb_couchbase/cachedb_couchbase.c
    M modules/cachedb_local/cachedb_local.c
    M modules/cachedb_memcached/cachedb_memcached.c
    M modules/cachedb_mongodb/cachedb_mongodb.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.c
    M modules/cachedb_mongodb/cachedb_mongodb_dbase.h
    M modules/cachedb_redis/cachedb_redis_dbase.c
    M modules/cachedb_sql/cachedb_sql.c
    M net/trans.c
    M sr_module.c
    M sr_module.h
    M str.h
    A test/unit_tests.c
    A test/unit_tests.h
    M ut.h

  Log Message:
  -----------
  Merge branch 'feature/cachedb-column-oriented-api'


Compare: https://github.com/OpenSIPS/opensips/compare/f1ec655b0539...784aa13118eb


More information about the Devel mailing list