netatalk  4.6.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
subtests.h File Reference
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <atalk/cnid.h>
#include <atalk/directory.h>
#include <atalk/globals.h>
#include <atalk/logger.h>
#include <atalk/queue.h>
#include <atalk/util.h>
#include <atalk/volume.h>
#include "afp_config.h"
#include "dircache.h"
#include "directory.h"
#include "hash.h"
#include "volume.h"

Go to the source code of this file.

Functions

int test001_add_x_dirs (const struct vol *vol, cnid_t start, cnid_t end)
int test002_rem_x_dirs (const struct vol *vol, cnid_t start, cnid_t end)
int test003_dir_add_error_no_double_free (struct vol *vol)
int test004_getmetadata_nostat_keeps_cache (struct vol *vol)
int test005_getmetadata_open_fork_outlives_path (struct vol *vol)
int test006_rflen_rfork_without_metadata (struct vol *vol)
int test007_add_over_existing_key_leaves_one (struct vol *vol)
 A second entry may never be published under a key already in use.
int test008_reindex_over_stale_key_expunges (struct vol *vol)
 Re-keying onto a name a stale entry still holds retires the holder.
int test009_file_add_over_curdir_did (struct vol *vol)
 curdir survives its entry being expunged by a file
int test010_full_cache_accepts_adds (struct vol *vol, unsigned int cache_size)
 A full dircache keeps accepting inserts.
int dircache_test_ghost_trim_selection (void)
 Ghost-trim selection never yields the pinned entry.

Function Documentation

◆ dircache_test_ghost_trim_selection()

int dircache_test_ghost_trim_selection ( void )
extern

Ghost-trim selection never yields the pinned entry.

Throwaway queues suffice: only the choice of node is under test.

Returns
0, else the number of the case that disagreed

◆ test001_add_x_dirs()

int test001_add_x_dirs ( const struct vol * vol,
cnid_t start,
cnid_t end )
extern

◆ test002_rem_x_dirs()

int test002_rem_x_dirs ( const struct vol * vol,
cnid_t start,
cnid_t end )
extern

◆ test003_dir_add_error_no_double_free()

int test003_dir_add_error_no_double_free ( struct vol * vol)
extern

◆ test004_getmetadata_nostat_keeps_cache()

int test004_getmetadata_nostat_keeps_cache ( struct vol * vol)
extern

◆ test005_getmetadata_open_fork_outlives_path()

int test005_getmetadata_open_fork_outlives_path ( struct vol * vol)
extern

◆ test006_rflen_rfork_without_metadata()

int test006_rflen_rfork_without_metadata ( struct vol * vol)
extern

◆ test007_add_over_existing_key_leaves_one()

int test007_add_over_existing_key_leaves_one ( struct vol * vol)
extern

A second entry may never be published under a key already in use.

A key may name only one entry. Adds over both keys — (vid, did) and (vid, pdid, uname) — with curdir on the entry being retired, the case that drives a recovery lookup back into dircache_add().

◆ test008_reindex_over_stale_key_expunges()

int test008_reindex_over_stale_key_expunges ( struct vol * vol)
extern

Re-keying onto a name a stale entry still holds retires the holder.

dir_modify(DCMOD_PATH) re-inserts under the destination key; a stale cache entry for that key must be expunged, or the key would name two entries.

Returns
0, else the number of the step that disagreed

◆ test009_file_add_over_curdir_did()

int test009_file_add_over_curdir_did ( struct vol * vol)
extern

curdir survives its entry being expunged by a file

A file colliding on the (vid, did) key retires the cached directory — a mid-session CNID reset can hand a file a directory's stale did. A file cannot stand in as curdir, so curdir must land on the volume root, never NULL.

Returns
0, else the number of the step that disagreed

◆ test010_full_cache_accepts_adds()

int test010_full_cache_accepts_adds ( struct vol * vol,
unsigned int cache_size )
extern

A full dircache keeps accepting inserts.

A cached entry and its ghost both occupy a hash slot, so once the working set exceeds the cache size the hash sits at its 2c capacity; every add past that point must release a slot before it inserts, or hash_insert()'s capacity assert aborts. Ghosts appear only where an eviction demotes a frequently-used entry, so each add is promoted at once: the entry moves to T2 and its eventual eviction lands in B2, filling the cache to 2c. The margin beyond that drives inserts against a cache pinned at capacity.

Promoted rather than looked up: the planted names do not exist on disk, so a lookup that validated would stat through the parent and expunge.

Parameters
[in]volvolume the entries are planted on
[in]cache_sizethe size dircache_init() was called with
Returns
0, else the number of the step that disagreed