Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/509 remove cpputests #711

Merged
merged 21 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8af7bff
Remove cpputest config, cpputest usage and linked list
pnoltes Dec 23, 2023
6a4d2a9
Remove cpputest from build config
pnoltes Dec 23, 2023
577551e
Remove cpputests for array and linked list
pnoltes Dec 23, 2023
daa0060
Remove deprecated array_list and its usage
pnoltes Dec 23, 2023
5d97401
Refactor hash_map cpputests to gtests
pnoltes Dec 30, 2023
d1f7d10
Refactor ip utils and ip utils tests
pnoltes Dec 30, 2023
bcfb6b2
Merge branch 'master' into feature/509-remove-cpputests
pnoltes Dec 30, 2023
8d113a3
Remove cpputest from build config
pnoltes Dec 30, 2023
01b3af1
Improve error handling of IP utils
pnoltes Dec 30, 2023
61c641a
Replace array_list with celix_array_list in rsa shm v2
pnoltes Dec 30, 2023
a851bf9
Replace array_list with celix_array_list in conan exmpl test
pnoltes Dec 30, 2023
f2317ed
Separate celix err ei test to prevent unintentionally init of tss
pnoltes Dec 31, 2023
4bb8990
Fix memleak in celix_utils_findIpInSubnet when calling getifaddrs
pnoltes Dec 31, 2023
1f8dea8
Fix invalid snprintf
pnoltes Dec 31, 2023
1a67dab
Replace EXPECT_EQ for pointer compare
pnoltes Dec 31, 2023
4de66c3
Merge branch 'master' into feature/509-remove-cpputests
pnoltes Jan 4, 2024
b4b26a3
Remove ip utils
pnoltes Jan 4, 2024
7a9bae9
Remove unused linked_list source files
pnoltes Jan 4, 2024
cd8bfd5
Refactor endpointDiscoveryPoller_poll for indent and error handling
pnoltes Jan 4, 2024
36d8c40
Remove unneeded export macros in hash_map_private.h
pnoltes Jan 4, 2024
2e2805b
Merge branch 'master' into feature/509-remove-cpputests
pnoltes Jan 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
-o celix:enable_testing_on_ci=True
-o celix:enable_ccache=True
run: |
conan install . celix/ci -pr:b default -pr:h default -if build ${CONAN_BUILD_OPTIONS} -b missing -b cpputest --require-override=openssl/1.1.1s
conan install . celix/ci -pr:b default -pr:h default -if build ${CONAN_BUILD_OPTIONS} -b missing --require-override=openssl/1.1.1s
- name: Build
run: |
conan build . -bf build
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/coverity-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
cmake \
libffi-dev \
libxml2-dev \
libcpputest-dev \
rapidjson-dev \
libavahi-compat-libdnssd-dev \
libcivetweb-dev \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
-o celix/*:framework_curlinit=False
-o celix/*:enable_ccache=True
run: |
conan build . -c tools.cmake.cmaketoolchain:generator=Ninja -pr:b default -pr:h default -s:b build_type=Release -s:h build_type=Release -of build ${CONAN_BUILD_OPTIONS} -b missing -b cpputest
conan build . -c tools.cmake.cmaketoolchain:generator=Ninja -pr:b default -pr:h default -s:b build_type=Release -s:h build_type=Release -of build ${CONAN_BUILD_OPTIONS} -b missing
- name: Test
run: |
cd build
Expand All @@ -75,7 +75,7 @@ jobs:
uses: actions/checkout@v3.3.0
- name: Install dependencies
run: |
brew install lcov cpputest jansson rapidjson libzip ccache ninja
brew install lcov jansson rapidjson libzip ccache ninja
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
-o celix:framework_curlinit=False
-o celix:enable_ccache=True
run: |
conan install . celix/ci -c tools.cmake.cmaketoolchain:generator=Ninja -pr:b release -pr:h default -if build ${CONAN_BUILD_OPTIONS} -b missing -b cpputest --require-override=openssl/1.1.1s
conan install . celix/ci -c tools.cmake.cmaketoolchain:generator=Ninja -pr:b release -pr:h default -if build ${CONAN_BUILD_OPTIONS} -b missing --require-override=openssl/1.1.1s
- name: Build
env:
CC: ${{ matrix.compiler[0] }}
Expand Down Expand Up @@ -119,7 +119,6 @@ jobs:
cmake \
libffi-dev \
libxml2-dev \
libcpputest-dev \
rapidjson-dev \
libavahi-compat-libdnssd-dev \
libcivetweb-dev \
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ limitations under the License.
THe celix_status_t is used to indicate an ENOMEM error.
- Embedded bundles are no longer supported.
- properties.h is removed and no longer supported. Use celix_properties.h instead.
- linked_list.h is removed and no longer supported. Use celix_array_list.h instead.
- ip_utils.h is removed and no longer supported.
- array_list.h is removed and no longer supported. Use celix_array_list.h instead.

## New Features

Expand Down
17 changes: 9 additions & 8 deletions bundles/http_admin/http_admin/src/http_admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
* under the License.
*/

#include <stdlib.h>
#include <memory.h>
#include <ctype.h>
#include <limits.h>
#include <memory.h>
#include <stdlib.h>
#include <unistd.h>

#include "http_admin.h"
Expand Down Expand Up @@ -355,9 +356,9 @@ static void httpAdmin_updateInfoSvc(http_admin_manager_t *admin) {
size_t resources_urls_size;
FILE *stream = open_memstream(&resources_urls, &resources_urls_size);

unsigned int size = arrayList_size(admin->aliasList);
unsigned int size = celix_arrayList_size(admin->aliasList);
for (unsigned int i = 0; i < size; ++i) {
http_alias_t *alias = arrayList_get(admin->aliasList, i);
http_alias_t *alias = celix_arrayList_get(admin->aliasList, i);
bool isLast = (i == size-1);
const char *separator = isLast ? "" : ",";
fprintf(stream, "%s%s", alias->url, separator);
Expand Down Expand Up @@ -456,9 +457,9 @@ static void createAliasesSymlink(const char *aliases, const char *admin_root, co
* @return true if alias is already in the list, false if not.
*/
static bool aliasList_containsAlias(celix_array_list_t *alias_list, const char *alias) {
unsigned int size = arrayList_size(alias_list);
unsigned int size = celix_arrayList_size(alias_list);
for(unsigned int i = 0; i < size; i++) {
http_alias_t *http_alias = arrayList_get(alias_list, i);
http_alias_t *http_alias = celix_arrayList_get(alias_list, i);
if(strcmp(http_alias->alias_path, alias) == 0) {
return true;
}
Expand Down Expand Up @@ -492,9 +493,9 @@ void http_admin_stopBundle(void *data, const celix_bundle_t *bundle) {
long bundle_id = celix_bundle_getId(bundle);

//Remove all aliases which are connected to this bundle
unsigned int size = arrayList_size(admin->aliasList);
unsigned int size = celix_arrayList_size(admin->aliasList);
for (unsigned int i = (size - 1); i < size; i--) {
http_alias_t *alias = arrayList_get(admin->aliasList, i);
http_alias_t *alias = celix_arrayList_get(admin->aliasList, i);
if(alias->bundle_id == bundle_id) {
remove(alias->alias_path); //Delete alias in cache directory
free(alias->url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@

#include "endpoint_discovery_poller.h"
#include "celix_errno.h"
#include "array_list.h"
#include "celix_array_list.h"

typedef struct endpoint_descriptor_reader endpoint_descriptor_reader_t;

celix_status_t endpointDescriptorReader_create(endpoint_discovery_poller_t *poller, endpoint_descriptor_reader_t * *reader);
celix_status_t endpointDescriptorReader_destroy(endpoint_descriptor_reader_t * reader);

celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader_t * reader, char *document, array_list_pt *endpoints);
celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader_t * reader, char *document, celix_array_list_t** endpoints);


#endif /* ENDPOINT_DESCRIPTOR_READER_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
#define ENDPOINT_DESCRIPTOR_WRITER_H_

#include "celix_errno.h"
#include "array_list.h"
#include "celix_array_list.h"

typedef struct endpoint_descriptor_writer endpoint_descriptor_writer_t;

celix_status_t endpointDescriptorWriter_create(endpoint_descriptor_writer_t **writer);
celix_status_t endpointDescriptorWriter_destroy(endpoint_descriptor_writer_t *writer);
celix_status_t endpointDescriptorWriter_writeDocument(endpoint_descriptor_writer_t *writer, array_list_pt endpoints, char **document);
celix_status_t endpointDescriptorWriter_writeDocument(endpoint_descriptor_writer_t *writer, celix_array_list_t* endpoints, char **document);

#endif /* ENDPOINT_DESCRIPTOR_WRITER_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "celix_log_helper.h"
#include "celix_threads.h"
#include "hash_map.h"
#include "celix_array_list.h"

typedef struct endpoint_discovery_poller endpoint_discovery_poller_t;

Expand All @@ -55,6 +56,6 @@ celix_status_t endpointDiscoveryPoller_destroy(endpoint_discovery_poller_t *poll
celix_status_t endpointDiscoveryPoller_addDiscoveryEndpoint(endpoint_discovery_poller_t *poller, char *url);
celix_status_t endpointDiscoveryPoller_removeDiscoveryEndpoint(endpoint_discovery_poller_t *poller, char *url);

celix_status_t endpointDiscoveryPoller_getDiscoveryEndpoints(endpoint_discovery_poller_t *poller, array_list_pt urls);
celix_status_t endpointDiscoveryPoller_getDiscoveryEndpoints(endpoint_discovery_poller_t *poller, celix_array_list_t* urls);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing #include "celix_array_list.h".


#endif /* ENDPOINT_DISCOVERY_POLLER_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ void endpointDescriptorReader_addSingleValuedProperty(celix_properties_t *proper
celix_properties_set(properties, (char *) name, (char*) value);
}

void endpointDescriptorReader_addMultiValuedProperty(celix_properties_t *properties, const xmlChar* name, array_list_pt values) {
void endpointDescriptorReader_addMultiValuedProperty(celix_properties_t *properties, const xmlChar* name, celix_array_list_t* values) {
char *value = calloc(256, sizeof(*value));
if (value) {
unsigned int size = arrayList_size(values);
unsigned int size = celix_arrayList_size(values);
unsigned int i;
for (i = 0; i < size; i++) {
char* item = (char*) arrayList_get(values, i);
char* item = (char*) celix_arrayList_get(values, i);
if (i > 0) {
value = strcat(value, ",");
}
Expand All @@ -89,7 +89,7 @@ void endpointDescriptorReader_addMultiValuedProperty(celix_properties_t *propert
}
}

celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader_t *reader, char *document, array_list_pt *endpoints) {
celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader_t *reader, char *document, celix_array_list_t** endpoints) {
celix_status_t status = CELIX_SUCCESS;

reader->reader = xmlReaderForMemory(document, (int) strlen(document), NULL, "UTF-8", 0);
Expand All @@ -109,15 +109,14 @@ celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader
xmlChar *valueBuffer = xmlMalloc(256);
valueBuffer[0] = '\0';

array_list_pt propertyValues = NULL;
arrayList_create(&propertyValues);
celix_array_list_t* propertyValues = celix_arrayList_create();

array_list_pt endpointDescriptions = NULL;
celix_array_list_t* endpointDescriptions = NULL;
if (*endpoints) {
// use the given arraylist...
endpointDescriptions = *endpoints;
} else {
arrayList_create(&endpointDescriptions);
endpointDescriptions = celix_arrayList_create();
// return the read endpoints...
*endpoints = endpointDescriptions;
}
Expand Down Expand Up @@ -163,7 +162,7 @@ celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader
propertyValue = xmlTextReaderGetAttribute(reader->reader, VALUE);
xmlChar *vtype = xmlTextReaderGetAttribute(reader->reader, VALUE_TYPE);
propertyType = valueTypeFromString((char*) vtype);
arrayList_clear(propertyValues);
celix_arrayList_clear(propertyValues);

if (xmlTextReaderIsEmptyElement(reader->reader)) {
inProperty = false;
Expand Down Expand Up @@ -200,7 +199,7 @@ celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader
endpoint_description_t *endpointDescription = NULL;
// Completely parsed endpoint description, add it to our list of results...
if(endpointDescription_create(endpointProperties, &endpointDescription) == CELIX_SUCCESS){
arrayList_add(endpointDescriptions, endpointDescription);
celix_arrayList_add(endpointDescriptions, endpointDescription);
}

endpointProperties = celix_properties_create();
Expand All @@ -224,18 +223,18 @@ celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader

xmlFree((void *) propertyName);
unsigned int k=0;
for(;k<arrayList_size(propertyValues);k++){
free(arrayList_get(propertyValues,k));
for(;k<celix_arrayList_size(propertyValues);k++){
free(celix_arrayList_get(propertyValues,k));
}
arrayList_clear(propertyValues);
celix_arrayList_clear(propertyValues);

propertyType = VALUE_TYPE_STRING;
inArray = false;
inList = false;
inSet = false;
inXml = false;
} else if (xmlStrcmp(localname, VALUE) == 0) {
arrayList_add(propertyValues, strdup((char*) valueBuffer));
celix_arrayList_add(propertyValues, strdup((char*) valueBuffer));
valueBuffer[0] = 0;
inValue = false;
}
Expand All @@ -255,10 +254,10 @@ celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader
}

unsigned int k=0;
for(;k<arrayList_size(propertyValues);k++){
free(arrayList_get(propertyValues,k));
for(;k<celix_arrayList_size(propertyValues);k++){
free(celix_arrayList_get(propertyValues,k));
}
arrayList_destroy(propertyValues);
celix_arrayList_destroy(propertyValues);
xmlFree(valueBuffer);

xmlFreeTextReader(reader->reader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ celix_status_t endpointDescriptorWriter_destroy(endpoint_descriptor_writer_t *wr
return CELIX_SUCCESS;
}

celix_status_t endpointDescriptorWriter_writeDocument(endpoint_descriptor_writer_t *writer, array_list_pt endpoints, char **document) {
celix_status_t endpointDescriptorWriter_writeDocument(endpoint_descriptor_writer_t *writer, celix_array_list_t* endpoints, char **document) {
celix_status_t status = CELIX_SUCCESS;
int rc;

Expand All @@ -85,8 +85,8 @@ celix_status_t endpointDescriptorWriter_writeDocument(endpoint_descriptor_writer
status = CELIX_BUNDLE_EXCEPTION;
} else {
unsigned int i;
for (i = 0; i < arrayList_size(endpoints); i++) {
endpoint_description_t *endpoint = arrayList_get(endpoints, i);
for (i = 0; i < celix_arrayList_size(endpoints); i++) {
endpoint_description_t *endpoint = celix_arrayList_get(endpoints, i);
status = endpointDescriptorWriter_writeEndpoint(writer, endpoint);
}
if (status == CELIX_SUCCESS) {
Expand Down
Loading
Loading