static void check_csync_detect_update_db_new(void **state)
{
    CSYNC *csync = *state;
    csync_file_stat_t *st;
    csync_vio_file_stat_t *fs;
    int rc;

    fs = create_fstat("file.txt", 42000, 1, 0);
    assert_non_null(fs);

    rc = _csync_detect_update(csync,
                              "/tmp/check_csync1/file.txt",
                              fs,
                              CSYNC_FTW_TYPE_FILE);
    assert_int_equal(rc, 0);

    /* the instruction should be set to new  */
    st = c_rbtree_node_data(csync->local.tree->root);
    assert_int_equal(st->instruction, CSYNC_INSTRUCTION_NEW);

    /* set the instruction to UPDATED that it gets written to the statedb */
    st->instruction = CSYNC_INSTRUCTION_UPDATED;

    /* create a statedb */
    csync_set_status(csync, 0xFFFF);

    csync_vio_file_stat_destroy(fs);
}
Example #2
0
static void check_csync_detect_update_db_rename(void **state)
{
    CSYNC *csync = *state;
    // csync_file_stat_t *st;

    csync_vio_file_stat_t *fs;
    int rc = 0;

    fs = create_fstat("wurst.txt", 0, 1, 42);
    assert_non_null(fs);
    csync_set_statedb_exists(csync, 1);

    rc = _csync_detect_update(csync,
                              "/tmp/check_csync1/wurst.txt",
                              fs,
                              CSYNC_FTW_TYPE_FILE);
    assert_int_equal(rc, 0);

    /* the instruction should be set to rename */
    /*
     * temporarily broken.
    st = c_rbtree_node_data(csync->local.tree->root);
    assert_int_equal(st->instruction, CSYNC_INSTRUCTION_RENAME);

    st->instruction = CSYNC_INSTRUCTION_UPDATED;
    */
    /* create a statedb */
    csync_set_status(csync, 0xFFFF);

    csync_vio_file_stat_destroy(fs);
}
Example #3
0
static void check_csync_detect_update_db_eval(void **state)
{
    CSYNC *csync = (CSYNC*)*state;
    csync_file_stat_t *st;
    std::unique_ptr<csync_file_stat_t> fs;
    int rc;

    fs = create_fstat("file.txt", 0, 42);

    rc = _csync_detect_update(csync, std::move(fs));
    assert_int_equal(rc, 0);

    /* the instruction should be set to new  */
    st = csync->local.files.begin()->second.get();
    assert_int_equal(st->instruction, CSYNC_INSTRUCTION_NEW);

    /* create a statedb */
    csync_set_status(csync, 0xFFFF);
}
Example #4
0
static void check_csync_detect_update_db_rename(void **state)
{
    CSYNC *csync = (CSYNC*)*state;
    // csync_file_stat_t *st;

    std::unique_ptr<csync_file_stat_t> fs;
    int rc = 0;

    fs = create_fstat("wurst.txt", 0, 42);

    rc = _csync_detect_update(csync, std::move(fs));
    assert_int_equal(rc, 0);

    /* the instruction should be set to rename */
    /*
     * temporarily broken.
    st = csync->local.files.begin()->second.get();
    assert_int_equal(st->instruction, CSYNC_INSTRUCTION_RENAME);

    st->instruction = CSYNC_INSTRUCTION_UPDATED;
    */
    /* create a statedb */
    csync_set_status(csync, 0xFFFF);
}