Skip to content

Commit

Permalink
eval: Reorganize pmcheck pool filepath
Browse files Browse the repository at this point in the history
  • Loading branch information
zzz845zz committed Apr 5, 2023
1 parent 430dd97 commit b67a23f
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 74 deletions.
14 changes: 8 additions & 6 deletions evaluation/correctness/pmcheck/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ cd $BUILD
TARGET=$1
TOOL=$2
MODE=$3
pool_postfix=$(date +%s%3N)
pool_id=${TARGET}_${pool_postfix}

# Set
case $1 in
Expand Down Expand Up @@ -50,18 +52,18 @@ else
echo "invalid mode: $MODE (possible mode: model, random)"
exit
fi
echo "[Run] target: $TARGET, TOOL: $TOOL, (option: $OPT)"
dmsg "[Run] target: $TARGET, TOOL: $TOOL, (option: $OPT)"
echo "[Run] target: $TARGET, TOOL: $TOOL, (option: $OPT, pool: $pool_id)"
dmsg "[Run] target: $TARGET, TOOL: $TOOL, (option: $OPT, pool: $pool_id)"

# Run
export LD_LIBRARY_PATH=$PMCHECK:$RUSTSTD
export PMCheck="-d/mnt/pmem0/test/$TARGET/$TARGET.pool_valid $OPT"
rm -rf PMCheckOutput*
rm -rf /mnt/pmem0/test/$TARGET/*
export PMCheck="-d/mnt/pmem0/test/$pool_id/$pool_id.pool_valid $OPT"
ulimit -s 82920000
mkdir -p $OUT/$TOOL
# RUST_MIN_STACK=100000000 ./test_mmt_$TOOL $TARGET 2>&1>>$OUT/$TOOL/$TARGET.log
RUST_MIN_STACK=100000000 ./test_mmt_$TOOL $TARGET
RUST_MIN_STACK=100000000 ./test_mmt_$TOOL $TARGET $pool_postfix
# 2>&1 | tee -a the_log_file
rm -rf PMCheckOutput*
rm -rf /mnt/pmem0/test/$pool_id
echo "[Finish] target: $TARGET, TOOL: $TOOL, (option: $OPT)"
dmsg "[Finish] target: $TARGET, TOOL: $TOOL, (option: $OPT)"
44 changes: 22 additions & 22 deletions evaluation/correctness/pmcheck/test_mmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,65 @@

extern "C"
{
void test_simple();
void test_checkpoint();
void test_cas();
void test_queue_O0();
void test_queue_O1();
void test_queue_O2();
void test_queue_comb();
void test_treiber_stack();
void test_list();
void test_clevel();
void test_simple(const char*);
void test_checkpoint(const char*);
void test_cas(const char*);
void test_queue_O0(const char*);
void test_queue_O1(const char*);
void test_queue_O2(const char*);
void test_queue_comb(const char*);
void test_treiber_stack(const char*);
void test_list(const char*);
void test_clevel(const char*);
}

int main(int argc, char *argv[])
{
if (argc != 2)
if (argc != 3)
{
printf("Usage: %s <target>\n", argv[0]);
printf("Usage: %s <target> <pool_postfix>\n", argv[0]);
return 1;
}

if (strcmp(argv[1], "simple") == 0)
{
test_simple();
test_simple(argv[2]);
}
else if (strcmp(argv[1], "checkpoint") == 0)
{
test_checkpoint();
test_checkpoint(argv[2]);
}
else if (strcmp(argv[1], "detectable_cas") == 0)
{
test_cas();
test_cas(argv[2]);
}
else if (strcmp(argv[1], "queue_O0") == 0)
{
test_queue_O0();
test_queue_O0(argv[2]);
}
else if (strcmp(argv[1], "queue_O1") == 0)
{
test_queue_O1();
test_queue_O1(argv[2]);
}
else if (strcmp(argv[1], "queue_O2") == 0)
{
test_queue_O2();
test_queue_O2(argv[2]);
}
else if (strcmp(argv[1], "queue_comb") == 0)
{
test_queue_comb();
test_queue_comb(argv[2]);
}
else if (strcmp(argv[1], "treiber_stack") == 0)
{
test_treiber_stack();
test_treiber_stack(argv[2]);
}
else if (strcmp(argv[1], "list") == 0)
{
test_list();
test_list(argv[2]);
}
else if (strcmp(argv[1], "clevel") == 0)
{
test_clevel();
test_clevel(argv[2]);
}
else
{
Expand Down
14 changes: 9 additions & 5 deletions src/ds/clevel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2135,7 +2135,7 @@ pub(crate) mod test {
}
}

fn ins_del_look() {
fn ins_del_look(pool_postfix: Option<&str>) {
lazy_static::initialize(&ITEMS);

let (send, recv) = channel::bounded(1024);
Expand Down Expand Up @@ -2164,20 +2164,24 @@ pub(crate) mod test {
}
});

let filename = match pool_postfix {
Some(pool_postfix) => format!("{}_{}", FILE_NAME, pool_postfix),
None => FILE_NAME.to_owned(),
};
run_test::<TestRootObj<Clevel<TestValue, TestValue>>, InsDelLook>(
FILE_NAME, FILE_SIZE, NR_THREAD, NR_COUNT,
&filename, FILE_SIZE, NR_THREAD, NR_COUNT,
);
}

#[test]
fn clevel_ins_del_look() {
ins_del_look();
ins_del_look(None);
}

/// Test function for psan
#[cfg(feature = "pmcheck")]
pub(crate) fn pmcheck_ins_del_look() {
ins_del_look();
pub(crate) fn pmcheck_ins_del_look(pool_postfix: &str) {
ins_del_look(Some(pool_postfix));
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/ds/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,14 +536,14 @@ pub(crate) mod test {

/// Test function for pmcheck
#[cfg(feature = "pmcheck")]
pub(crate) fn pmcheck_ins_del_look() {
pub(crate) fn pmcheck_ins_del_look(pool_postfix: &str) {
const FILE_NAME: &str = "list";
const FILE_SIZE: usize = 8 * 1024 * 1024 * 1024;

let filename = format!("{}_{}", FILE_NAME, pool_postfix);
lazy_static::initialize(&ITEMS);

run_test::<TestRootObj<List<TestValue, TestValue>>, InsDelLook>(
FILE_NAME, FILE_SIZE, NR_THREAD, NR_COUNT,
&filename, FILE_SIZE, NR_THREAD, NR_COUNT,
);
}
}
6 changes: 4 additions & 2 deletions src/ds/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,13 @@ pub(crate) mod test {

/// Test function for psan
#[cfg(feature = "pmcheck")]
pub(crate) fn enqdeq() {
pub(crate) fn enqdeq(pool_postfix: &str) {
const FILE_NAME: &str = "queue_O2";
const FILE_SIZE: usize = 8 * 1024 * 1024 * 1024;

let filename = format!("{}_{}", FILE_NAME, pool_postfix);
run_test::<TestRootObj<Queue<TestValue>>, EnqDeq>(
FILE_NAME, FILE_SIZE, NR_THREAD, NR_COUNT,
&filename, FILE_SIZE, NR_THREAD, NR_COUNT,
);
}
}
6 changes: 4 additions & 2 deletions src/ds/queue_comb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,11 @@ pub(crate) mod test {

/// Test function for psan
#[cfg(feature = "pmcheck")]
pub(crate) fn enqdeq() {
pub(crate) fn enqdeq(pool_postfix: &str) {
const FILE_NAME: &str = "queue_comb";
const FILE_SIZE: usize = 8 * 1024 * 1024 * 1024;
run_test::<TestRootObj<CombiningQueue>, EnqDeq>(FILE_NAME, FILE_SIZE, NR_THREAD, NR_COUNT);

let filename = format!("{}_{}", FILE_NAME, pool_postfix);
run_test::<TestRootObj<CombiningQueue>, EnqDeq>(&filename, FILE_SIZE, NR_THREAD, NR_COUNT);
}
}
6 changes: 4 additions & 2 deletions src/ds/queue_general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,13 @@ pub(crate) mod test {

/// Test function for pmcheck
#[cfg(feature = "pmcheck")]
pub(crate) fn enqdeq() {
pub(crate) fn enqdeq(pool_postfix: &str) {
const FILE_NAME: &str = "queue_O0";
const FILE_SIZE: usize = 8 * 1024 * 1024 * 1024;

let filename = format!("{}_{}", FILE_NAME, pool_postfix);
run_test::<TestRootObj<QueueGeneral<TestValue>>, EnqDeq>(
FILE_NAME, FILE_SIZE, NR_THREAD, NR_COUNT,
&filename, FILE_SIZE, NR_THREAD, NR_COUNT,
);
}
}
6 changes: 4 additions & 2 deletions src/ds/queue_lp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,13 @@ pub(crate) mod test {

/// Test function for psan
#[cfg(feature = "pmcheck")]
pub(crate) fn enqdeq() {
pub(crate) fn enqdeq(pool_postfix: &str) {
const FILE_NAME: &str = "queue_O1";
const FILE_SIZE: usize = 8 * 1024 * 1024 * 1024;

let filename = format!("{}_{}", FILE_NAME, pool_postfix);
run_test::<TestRootObj<Queue<TestValue>>, EnqDeq>(
FILE_NAME, FILE_SIZE, NR_THREAD, NR_COUNT,
&filename, FILE_SIZE, NR_THREAD, NR_COUNT,
);
}
}
6 changes: 4 additions & 2 deletions src/ds/treiber_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,12 @@ pub(crate) mod test {

/// Test function for psan
#[cfg(feature = "pmcheck")]
pub(crate) fn pushpop() {
pub(crate) fn pushpop(pool_postfix: &str) {
const FILE_NAME: &str = "treiber_stack";

let filename = format!("{}_{}", FILE_NAME, pool_postfix);
run_test::<TestRootObj<TreiberStack<TestValue>>, PushPop<_, NR_THREAD, NR_COUNT>>(
FILE_NAME, FILE_SIZE, NR_THREAD, NR_COUNT,
&filename, FILE_SIZE, NR_THREAD, NR_COUNT,
)
}
}
47 changes: 27 additions & 20 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,64 +153,71 @@ impl<T: Memento> Memento for CachePadded<T> {}
#[cfg(feature = "pmcheck")]
pub mod test_pmcheck {
use super::*;
use libc::c_char;
use std::ffi::CStr;

fn get_str(char: *const c_char) -> &'static str {
let c_str: &CStr = unsafe { CStr::from_ptr(char) };
c_str.to_str().unwrap()
}

/// Test Simple
#[no_mangle]
pub extern "C" fn test_simple() {
pmem::test::check_invaa();
pub extern "C" fn test_simple(pool_postfix: *const c_char) {
pmem::test::check_invaa(get_str(pool_postfix));
}

/// Test Checkpoint
#[no_mangle]
pub extern "C" fn test_checkpoint() {
ploc::tests::chks();
pub extern "C" fn test_checkpoint(pool_postfix: *const c_char) {
ploc::tests::chks(get_str(pool_postfix));
}

/// Test Cas
#[no_mangle]
pub extern "C" fn test_cas() {
ploc::test::dcas();
pub extern "C" fn test_cas(pool_postfix: *const c_char) {
ploc::test::dcas(get_str(pool_postfix));
}

/// Test Queue-O0
#[no_mangle]
pub extern "C" fn test_queue_O0() {
ds::queue_general::test::enqdeq();
pub extern "C" fn test_queue_O0(pool_postfix: *const c_char) {
ds::queue_general::test::enqdeq(get_str(pool_postfix));
}

/// Test Queue-O1
#[no_mangle]
pub extern "C" fn test_queue_O1() {
ds::queue_lp::test::enqdeq();
pub extern "C" fn test_queue_O1(pool_postfix: *const c_char) {
ds::queue_lp::test::enqdeq(get_str(pool_postfix));
}

/// Test Queue-O2
#[no_mangle]
pub extern "C" fn test_queue_O2() {
ds::queue::test::enqdeq();
pub extern "C" fn test_queue_O2(pool_postfix: *const c_char) {
ds::queue::test::enqdeq(get_str(pool_postfix));
}

/// Test Queue-Comb
#[no_mangle]
pub extern "C" fn test_queue_comb() {
ds::queue_comb::test::enqdeq();
pub extern "C" fn test_queue_comb(pool_postfix: *const c_char) {
ds::queue_comb::test::enqdeq(get_str(pool_postfix));
}

/// Test Teriber stack
#[no_mangle]
pub extern "C" fn test_treiber_stack() {
ds::treiber_stack::test::pushpop();
pub extern "C" fn test_treiber_stack(pool_postfix: *const c_char) {
ds::treiber_stack::test::pushpop(get_str(pool_postfix));
}

/// Test List
#[no_mangle]
pub extern "C" fn test_list() {
ds::list::test::pmcheck_ins_del_look();
pub extern "C" fn test_list(pool_postfix: *const c_char) {
ds::list::test::pmcheck_ins_del_look(get_str(pool_postfix));
}

/// Test Clevel
#[no_mangle]
pub extern "C" fn test_clevel() {
ds::clevel::test::pmcheck_ins_del_look();
pub extern "C" fn test_clevel(pool_postfix: *const c_char) {
ds::clevel::test::pmcheck_ins_del_look(get_str(pool_postfix));
}
}
7 changes: 4 additions & 3 deletions src/ploc/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,12 @@ pub mod tests {
}

/// Test checkpoint for psan
#[cfg(feature = "pmcheck")]
pub fn chks() {
// #[cfg(feature = "pmcheck")]
pub fn chks(pool_postfix: &str) {
const FILE_NAME: &str = "checkpoint";
const FILE_SIZE: usize = 8 * 1024 * 1024 * 1024;

run_test::<TestRootObj<DummyRootObj>, Checkpoints>(FILE_NAME, FILE_SIZE, 2, NR_COUNT);
let filename = format!("{}_{}", FILE_NAME, pool_postfix);
run_test::<TestRootObj<DummyRootObj>, Checkpoints>(&filename, FILE_SIZE, 2, NR_COUNT);
}
}
5 changes: 3 additions & 2 deletions src/ploc/detectable_cas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,12 +960,13 @@ pub(crate) mod test {

/// Test function pmcheck
#[cfg(feature = "pmcheck")]
pub(crate) fn dcas() {
pub(crate) fn dcas(pool_postfix: &str) {
const FILE_NAME: &str = "detectable_cas";
const FILE_SIZE: usize = 8 * 1024 * 1024 * 1024;

let filename = format!("{}_{}", FILE_NAME, pool_postfix);
run_test::<TestRootObj<Location<TestValue>>, Updates>(
FILE_NAME, FILE_SIZE, NR_THREAD, NR_COUNT,
&filename, FILE_SIZE, NR_THREAD, NR_COUNT,
);
}
}
6 changes: 4 additions & 2 deletions src/pmem/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,11 @@ pub mod test {
/// check flag=1 => value=42
/// TODO chek inv for pmcheck
#[cfg(feature = "pmcheck")]
pub fn check_invaa() {
pub fn check_invaa(pool_postfix: &str) {
const FILE_NAME: &str = "check_inv";
const FILE_SIZE: usize = 8 * 1024 * 1024 * 1024;
run_test::<DummyRootObj, CheckInv>(FILE_NAME, FILE_SIZE, 1, 1);

let filename = format!("{}_{}", FILE_NAME, pool_postfix);
run_test::<DummyRootObj, CheckInv>(&filename, FILE_SIZE, 1, 1);
}
}
Loading

0 comments on commit b67a23f

Please sign in to comment.