Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
celllframe-node
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitry Puzyrkov
celllframe-node
Commits
f7aa521d
Unverified
Commit
f7aa521d
authored
5 years ago
by
Dmitriy A. Gerasimov
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #28 from cellframe/feature-2313
Feature 2313
parents
d241e2df
f8fe21b7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sources/main_node_cli_net.c
+1
-1
1 addition, 1 deletion
sources/main_node_cli_net.c
test/dap_global_db_test.c
+39
-17
39 additions, 17 deletions
test/dap_global_db_test.c
with
40 additions
and
18 deletions
sources/main_node_cli_net.c
+
1
−
1
View file @
f7aa521d
...
@@ -100,7 +100,7 @@ connect_param* node_cli_connect(void)
...
@@ -100,7 +100,7 @@ connect_param* node_cli_connect(void)
connect_param
*
param
=
DAP_NEW_Z
(
connect_param
);
connect_param
*
param
=
DAP_NEW_Z
(
connect_param
);
CURL
*
curl_handle
=
curl_easy_init
();
CURL
*
curl_handle
=
curl_easy_init
();
int
ret
=
curl_easy_setopt
(
curl_handle
,
CURLOPT_UNIX_SOCKET_PATH
,
UNIX_SOCKET_FILE
);
// unix socket mode
int
ret
=
curl_easy_setopt
(
curl_handle
,
CURLOPT_UNIX_SOCKET_PATH
,
UNIX_SOCKET_FILE
);
// unix socket mode
curl_easy_setopt
(
curl_handle
,
CURLOPT_TIMEOUT
,
60L
);
// complete within
6
0
second
s
curl_easy_setopt
(
curl_handle
,
CURLOPT_TIMEOUT
,
60
0
L
);
// complete within
1
0
minute
s
ret
=
curl_easy_setopt
(
curl_handle
,
CURLOPT_CONNECT_ONLY
,
1L
);
// connection only
ret
=
curl_easy_setopt
(
curl_handle
,
CURLOPT_CONNECT_ONLY
,
1L
);
// connection only
ret
=
curl_easy_setopt
(
curl_handle
,
CURLOPT_URL
,
"http:/localhost/connect"
);
ret
=
curl_easy_setopt
(
curl_handle
,
CURLOPT_URL
,
"http:/localhost/connect"
);
// execute request
// execute request
...
...
This diff is collapsed.
Click to expand it.
test/dap_global_db_test.c
+
39
−
17
View file @
f7aa521d
...
@@ -3,18 +3,29 @@
...
@@ -3,18 +3,29 @@
#include
"dap_common.h"
#include
"dap_common.h"
#include
"dap_strfuncs.h"
#include
"dap_strfuncs.h"
#include
"dap_file_utils.h"
//#include "dap_list.h"
//#include "dap_list.h"
#include
"dap_chain_global_db.h"
#include
"dap_chain_global_db.h"
#include
"dap_chain_global_db_driver.h"
#include
"dap_chain_global_db_driver.h"
#include
"dap_global_db_test.h"
#include
"dap_global_db_test.h"
#define DB_FILE "./base.
sqlite
"
#define DB_FILE "./base.
tmp
"
static
void
test_create_db
(
void
)
static
void
test_create_db
(
const
char
*
db_type
)
{
{
unlink
(
DB_FILE
);
if
(
dap_dir_test
(
DB_FILE
))
{
int
res
=
dap_db_driver_init
(
"sqlite"
,
DB_FILE
);
rmdir
(
DB_FILE
);
dap_assert
(
!
res
,
"Test init global_db"
);
char
*
l_cmd
=
dap_strdup_printf
(
"rm -rf %s"
,
DB_FILE
);
system
(
l_cmd
);
DAP_DELETE
(
l_cmd
);
}
else
unlink
(
DB_FILE
);
int
res
=
dap_db_driver_init
(
db_type
,
DB_FILE
);
char
*
l_str
=
dap_strdup_printf
(
"Test init %s global_db"
,
db_type
);
dap_assert
(
!
res
,
l_str
);
DAP_DELETE
(
l_str
);
}
}
static
void
test_write_read_one
(
void
)
static
void
test_write_read_one
(
void
)
{
{
...
@@ -49,14 +60,13 @@ static void test_write_read_one(void)
...
@@ -49,14 +60,13 @@ static void test_write_read_one(void)
dap_store_obj_free
(
l_store_obj
,
1
);
dap_store_obj_free
(
l_store_obj
,
1
);
dap_store_obj_free
(
l_store_obj2
,
1
);
dap_store_obj_free
(
l_store_obj2
,
1
);
dap_assert
(
1
,
"Test dap_global_db one record"
);
dap_assert
(
1
,
"Test dap_global_db one record"
);
}
}
static
void
test_close_db
(
void
)
static
void
test_close_db
(
void
)
{
{
dap_db_driver_deinit
();
//dap_chain_global_db_deinit();
dap_db_driver_deinit
();
//dap_chain_global_db_deinit();
dap_assert
(
1
,
"Test close global_db"
);
dap_assert
(
1
,
"Test close global_db"
);
}
}
...
@@ -112,24 +122,36 @@ void dap_global_db_tests_run(void)
...
@@ -112,24 +122,36 @@ void dap_global_db_tests_run(void)
{
{
dap_print_module_name
(
"dap_global_db"
);
dap_print_module_name
(
"dap_global_db"
);
unlink
(
DB_FILE
);
// cdb
test_create_db
();
test_create_db
(
"cdb"
);
test_write_read_one
();
benchmark_mgs_time
(
"Read and Write in cdb 20000 records"
,
benchmark_test_time
(
test_write_db_count
,
1
));
// sqlite
test_create_db
(
"sqlite"
);
test_write_read_one
();
test_write_read_one
();
// test_write_db_count(1000000);
// test_write_db_count(1000000);
benchmark_mgs_time
(
"Read and Write in global_db 20000 records"
,
benchmark_mgs_time
(
"Read and Write in sqlite 20000 records"
,
benchmark_test_time
(
test_write_db_count
,
1
));
benchmark_test_time
(
test_write_db_count
,
1
));
//test_close_db();
//dap_assert(1, "Test dap_global_db: write and read 20000 records");
//dap_assert(1, "Test dap_global_db: write and read 20000 records");
/*
/*
benchmark_mgs_time("Read and Write in global_db 100 times",
benchmark_mgs_time("Read and Write in global_db 100 times",
benchmark_test_time(test_write_db_count, 1));
benchmark_test_time(test_write_db_count, 1));
dap_assert(1, "Test dap_global_db 100 records");
dap_assert(1, "Test dap_global_db 100 records");
*/
*/
// benchmark_mgs_rate("Read and Write in global_db",
// benchmark_mgs_rate("Read and Write in global_db",
// benchmark_test_rate(test_write_db_count, 2000));
// benchmark_test_rate(test_write_db_count, 2000));
//dap_usleep(2 * DAP_USEC_PER_SEC);
//dap_usleep(2 * DAP_USEC_PER_SEC);
test_close_db
();
test_close_db
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment