#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2018-2019, Intel Corporation

#
# src/test/pmreorder_simple/TEST5 -- unit test for the reordering script
# Tests positive case using full reorder engine for section marked as the most
# critical and additionally enables pmreorder logs in libpmem library to test
# disabling reordering of API functions
#

. ../unittest/unittest.sh

require_fs_type pmem non-pmem
require_build_type debug
require_test_type medium
require_pmemcheck_version_ge 1 0
require_pmemcheck_version_lt 2 0
require_pmreorder

setup

export PMREORDER_EMIT_LOG=1

# create holey file
truncate -s 4M $DIR/testfile

BIN="./pmreorder_simple$EXESUFFIX"
PMEMCHECK_CMD="$BIN m $DIR/testfile"
PMREORDER_CMD="$BIN c"

pmreorder_create_store_log $DIR/testfile "$PMEMCHECK_CMD"
pmreorder_expect_success ReorderFull pmreorder$UNITTEST_NUM.conf "$PMREORDER_CMD"

check

pass
