Skip to content
Snippets Groups Projects
functional_test_qos.c 950 B
Newer Older
  • Learn to ignore specific revisions
  • Oskar Viljasaar's avatar
    Oskar Viljasaar committed
    #include <stdarg.h>
    #include <stddef.h>
    #include <setjmp.h>
    #include <cmocka.h>
    
    #include <libubus.h>
    #include <libubox/blobmsg_json.h>
    #include <libubox/blobmsg.h>
    
    #include <json-validator.h>
    #include <json-c/json.h>
    #include <json-editor.h>
    
    #include <json-c/json_tokener.h>
    #include <easy/easy.h>
    #include <qos.h>
    
    #include "qosmngr.h"
    
    struct test_ctx {
    	FILE *fp;
    };
    
    int qosmngr_event_main(const char *evmap_file);
    
    static int group_setup(void **state)
    {
    	struct test_ctx *ctx = calloc(1, sizeof(struct test_ctx));
    
    	if (!ctx)
    		return -1;
    
    	remove("/tmp/test.log");
    
    	*state = ctx;
    	return 0;
    }
    
    static int group_teardown(void **state)
    {
    	struct test_ctx *ctx = (struct test_ctx *) *state;
    
    	free(ctx);
    	remove("/tmp/test.log");
    
    	/* TODO: fix event poll file */
    	//if (ctx->fp)
    		//fclose(ctx->fp);
    	return 0;
    }
    
    int main(void)
    {
    	const struct CMUnitTest tests[] = {	};
    
    	return cmocka_run_group_tests(tests, group_setup, group_teardown);
    }