Commit 0155657c authored by Ramon Nou's avatar Ramon Nou
Browse files

Merge branch '32-replace-margo-with-mercury-in-client-code' into '44-adding-tests'

# Conflicts:
#   .gitlab-ci.yml
parents 8ea12c9e b06ed345
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ test wr:
    - sleep 4
    - LD_PRELOAD=${INSTALL_PATH}/lib/libgkfs_intercept.so ${TESTS_BUILD_PATH}/gkfs_test_wr
  artifacts:
    when: on_failure
    paths:
     - "${LOG_PATH}"

@@ -93,6 +94,7 @@ test directories:
    - sleep 4
    - LD_PRELOAD=${INSTALL_PATH}/lib/libgkfs_intercept.so ${TESTS_BUILD_PATH}/gkfs_test_dir
  artifacts:
    when: on_failure
    paths:
     - "${LOG_PATH}"

@@ -104,6 +106,7 @@ test truncate:
    - sleep 4
    - LD_PRELOAD=${INSTALL_PATH}/lib/libgkfs_intercept.so ${TESTS_BUILD_PATH}/gkfs_test_truncate
  artifacts:
    when: on_failure
    paths:
     - "${LOG_PATH}"

@@ -115,6 +118,7 @@ test path resolution:
    - sleep 4
    - LD_PRELOAD=${INSTALL_PATH}/lib/libgkfs_intercept.so ${TESTS_BUILD_PATH}/gkfs_test_path_resolution
  artifacts:
    when: on_failure
    paths:
     - "${LOG_PATH}"

@@ -126,6 +130,7 @@ test lseek:
    - sleep 4
    - LD_PRELOAD=${INSTALL_PATH}/lib/libgkfs_intercept.so ${TESTS_BUILD_PATH}/gkfs_test_lseek
  artifacts:
    when: on_failure
    paths:
     - "${LOG_PATH}"

+5 −0
Original line number Diff line number Diff line
@@ -169,6 +169,11 @@ The following modules are available:
 - `all`: All previous options combined.
 - `help`: Print a help message and exit.

When tracing sytem calls, specific syscalls can be removed from log messages by
setting the `LIBGKFS_LOG_SYSCALL_FILTER` environment variable. For instance,
setting it to `LIBGKFS_LOG_SYSCALL_FILTER=epoll_wait,epoll_create` will filter
out any log entries from the `epoll_wait()` and `epoll_create()` system calls.

Additionally, setting the `LIBGKFS_LOG_OUTPUT_TRUNC` environment variable with
a value different from `0` will instruct the logging subsystem to truncate 
the file used for logging, rather than append to it.
Compare 2e578554 to 32356080
Original line number Diff line number Diff line
Subproject commit 2e578554d52d734eec83b5def2602dde7b6ce570
Subproject commit 32356080bcb1b089957252e25ff3dceb715b572b
+10 −5
Original line number Diff line number Diff line
@@ -23,6 +23,11 @@ namespace gkfs {
namespace env {

static constexpr auto LOG                = ADD_PREFIX("LOG");

#ifdef GKFS_DEBUG_BUILD
static constexpr auto LOG_SYSCALL_FILTER = ADD_PREFIX("LOG_SYSCALL_FILTER");
#endif

static constexpr auto LOG_OUTPUT         = ADD_PREFIX("LOG_OUTPUT");
static constexpr auto LOG_OUTPUT_TRUNC   = ADD_PREFIX("LOG_OUTPUT_TRUNC");
static constexpr auto CWD                = ADD_PREFIX("CWD");
+14 −2
Original line number Diff line number Diff line
@@ -24,6 +24,10 @@
#include <fmt/ostr.h>
#include <date/tz.h>

#ifdef GKFS_DEBUG_BUILD
#include <bitset>
#endif

namespace gkfs {
namespace log {

@@ -264,7 +268,11 @@ struct logger {

    logger(const std::string& opts, 
           const std::string& path, 
           bool trunc);
           bool trunc,
#ifdef GKFS_DEBUG_BUILD
           const std::string& filter
#endif
           );

    ~logger();

@@ -397,10 +405,14 @@ struct logger {

    int log_fd_;
    log_level log_mask_;

#ifdef GKFS_DEBUG_BUILD
    std::bitset<512> filtered_syscalls_;
#endif

    const date::time_zone * const timezone_;
};


// the following static functions can be used to interact 
// with a globally registered logger instance

Loading