Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
cbe5094e
Commit
cbe5094e
authored
Sep 12, 2010
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tdb: missing files from checkin.
parent
655ef777
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
2 deletions
+47
-2
ccan/tdb/test/logging.c
ccan/tdb/test/logging.c
+33
-0
ccan/tdb/test/logging.h
ccan/tdb/test/logging.h
+10
-0
ccan/tdb/test/run-check.c
ccan/tdb/test/run-check.c
+4
-2
No files found.
ccan/tdb/test/logging.c
0 → 100644
View file @
cbe5094e
#include "logging.h"
#include <ccan/tap/tap.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
bool
suppress_logging
=
false
;
const
char
*
log_prefix
=
""
;
/* Turn log messages into tap diag messages. */
static
void
taplog
(
struct
tdb_context
*
tdb
,
enum
tdb_debug_level
level
,
const
char
*
fmt
,
...)
{
va_list
ap
;
char
line
[
200
];
if
(
suppress_logging
)
return
;
va_start
(
ap
,
fmt
);
vsprintf
(
line
,
fmt
,
ap
);
va_end
(
ap
);
/* Strip trailing \n: diag adds it. */
if
(
line
[
0
]
&&
line
[
strlen
(
line
)
-
1
]
==
'\n'
)
diag
(
"%s%.*s"
,
log_prefix
,
strlen
(
line
)
-
1
,
line
);
else
diag
(
"%s%s"
,
log_prefix
,
line
);
}
struct
tdb_logging_context
taplogctx
=
{
taplog
,
NULL
};
ccan/tdb/test/logging.h
0 → 100644
View file @
cbe5094e
#ifndef TDB_TEST_LOGGING_H
#define TDB_TEST_LOGGING_H
#include <ccan/tdb/tdb.h>
#include <stdbool.h>
extern
bool
suppress_logging
;
extern
const
char
*
log_prefix
;
extern
struct
tdb_logging_context
taplogctx
;
#endif
/* TDB_TEST_LOGGING_H */
ccan/tdb/test/run-check.c
View file @
cbe5094e
...
...
@@ -35,12 +35,14 @@ int main(int argc, char *argv[])
ok1
(
tdb_check
(
tdb
,
NULL
,
NULL
)
==
0
);
tdb_close
(
tdb
);
tdb
=
tdb_open
(
"run-check.tdb"
,
1024
,
0
,
O_RDWR
,
0
);
tdb
=
tdb_open_ex
(
"run-check.tdb"
,
1024
,
0
,
O_RDWR
,
0
,
&
taplogctx
,
NULL
);
ok1
(
tdb
);
ok1
(
tdb_check
(
tdb
,
NULL
,
NULL
)
==
0
);
tdb_close
(
tdb
);
tdb
=
tdb_open
(
"test/tdb.corrupt"
,
1024
,
0
,
O_RDWR
,
0
);
tdb
=
tdb_open_ex
(
"test/tdb.corrupt"
,
1024
,
0
,
O_RDWR
,
0
,
&
taplogctx
,
NULL
);
ok1
(
tdb
);
ok1
(
tdb_check
(
tdb
,
NULL
,
NULL
)
==
-
1
);
ok1
(
tdb_error
(
tdb
)
==
TDB_ERR_CORRUPT
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment