Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions CODING_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ log level for most frequently called routines.

### Unit tests
- There **must** be unit tests provided for each new function/module added.
- Test scripts **must** start with `#!/usr/bin/env <shell>` for portability between Linux and FreeBSD.
- Test scripts **must** start with `#!/usr/bin/env <shell>`.
- Please, see [this](https://github.com/pmem/pmdk/blob/master/src/test/README)
and [that](https://github.com/pmem/pmdk/blob/master/src/test/unittest/README)
and [that](https://github.com/pmem/pmdk/blob/master/src/test/_unittest/README)
document to get familiar with
our test framework and the guidelines on how to write and run unit tests.

Expand Down
4 changes: 2 additions & 2 deletions src/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
include ../common.inc

TEST_DEPS = \
unittest\
_unittest\
tools

OBJ_DEPS = \
Expand Down Expand Up @@ -406,5 +406,5 @@ SUPP_SYNC_FILES=$(shell echo *.supp | sed s/supp/$(SYNC_EXT)/g)

.PHONY: all check clean clobber cstyle pcheck pcheck-log pcheck-obj\
pcheck-other pcheck-pmem pcheck-pmempool\
test unittest tools format pcheck-libpmempool pycheck\
test _unittest tools format pcheck-libpmempool pycheck\
pcheck-local $(TESTS_BUILD)
6 changes: 3 additions & 3 deletions src/test/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ EX_LIBPMEM2=$(EXAMPLES_DIR)/libpmem2
EX_LIBPMEMOBJ=$(EXAMPLES_DIR)/libpmemobj
EX_PMREORDER=$(EXAMPLES_DIR)/pmreorder

UT = ../unittest/libut.a
UT = ../_unittest/libut.a
LIBS += $(UT) $(LIBUUID)

ifeq ($(USE_LIBUNWIND),y)
Expand Down Expand Up @@ -457,7 +457,7 @@ extract_funcs = $(shell \
print "-Wl,--wrap=" $$2 \
}' $(1) )

INCS += -I../unittest -I$(TOP)/src/include -I$(TOP)/src/common -I$(TOP)/src/core
INCS += -I../_unittest -I$(TOP)/src/include -I$(TOP)/src/common -I$(TOP)/src/core

COMMON_FLAGS = -ggdb
COMMON_FLAGS += -Wall
Expand Down Expand Up @@ -588,7 +588,7 @@ endif
all: $(TARGET) $(TARGET_STATIC_DEBUG) $(TARGET_STATIC_NONDEBUG)

$(UT):
$(MAKE) -C ../unittest
$(MAKE) -C ../_unittest

$(TARGET_STATIC_DEBUG): $(TMP_HEADERS) $(OBJS) $(UT) $(STATIC_DEBUG_LIBS) $(EXTRA_DEPS) $(MAKEFILE_DEPS)
$(LINKER) -o $@ $(LDFLAGS) $(OBJS) $(STATIC_DEBUG_LIBS) $(LIBS)
Expand Down
4 changes: 2 additions & 2 deletions src/test/README
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ DETAILS ON HOW TO WRITE UNIT TESTS

A minimal unit test consists of a sub-directory here with an executable called
TEST0 in it that exits normally when the test passes. Most tests, however,
source the file unittest/unittest.sh to use the utility functions for setting
source the file _unittest/unittest.sh to use the utility functions for setting
up and checking tests. Additionally, most unit tests build a local test
program and call it from the TEST* scripts.

Expand Down Expand Up @@ -233,7 +233,7 @@ The above call is just like calling open(2), expect the framework checks for
unexpected errors and halts the unit test if those happen. The result is
usually a very short, compact unit test where most of the code is the
interesting code under test. A full list of unit test macros is in
unittest/inittest.h.
_unittest/inittest.h.

The best way to create a new unit test is to start with an existing one. The
test:
Expand Down
7 changes: 4 additions & 3 deletions src/test/RUNTESTS.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2019-2023, Intel Corporation
# Copyright 2019-2024, Intel Corporation

"""Main script for unit tests execution.

Expand All @@ -13,11 +13,12 @@

"""

# modules from unittest directory are visible from this script
# modules from _unittest directory are visible from this script
import sys
import os
from os import path
sys.path.insert(1, path.abspath(path.join(path.dirname(__file__), 'unittest')))
sys.path.insert(1, path.abspath(path.join(path.dirname(__file__),
'_unittest')))

# flake8 issues silenced:
# E402 - import statements not at the top of the file because of adding
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/test/unittest/Makefile → src/test/_unittest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2014-2024, Intel Corporation

#
# src/test/unittest/Makefile -- build unittest support library
# src/test/_unittest/Makefile -- build unittest support library
#

TOP := $(dir $(lastword $(MAKEFILE_LIST)))../../..
Expand Down
2 changes: 1 addition & 1 deletion src/test/unittest/README → src/test/_unittest/README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Persistent Memory Development Kit

This is src/test/unittest/README.
This is src/test/_unittest/README.

This directory contains the unit test framework used by
the Persistent Memory Development Kit unit tests.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/test/arch_flags/TEST0
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2015-2019, Intel Corporation
# Copyright 2015-2024, Intel Corporation

#
# src/test/arch_flags/TEST0 -- unit test for util_get_arch_flags function
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium

Expand Down
4 changes: 2 additions & 2 deletions src/test/checksum/TEST0
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2014-2019, Intel Corporation
# Copyright 2014-2024, Intel Corporation

#
# src/test/checksum/TEST0 -- unit test for checksum
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium

Expand Down
4 changes: 2 additions & 2 deletions src/test/compat_incompat_features/TEST0
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2017-2023, Intel Corporation
# Copyright 2017-2024, Intel Corporation
#
#
# compat_incompat_features/TEST0 -- test for compat/incompat feature flags
#
# check if pool opens when compat flags are equal and nonzero
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium
require_fs_type any
Expand Down
4 changes: 2 additions & 2 deletions src/test/compat_incompat_features/TEST1
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2017-2023, Intel Corporation
# Copyright 2017-2024, Intel Corporation
#
#
# compat_incompat_features/TEST1 -- test for compat/incompat feature flags
#
# check if pool fails to open when compat flags differ between parts
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium
require_fs_type any
Expand Down
4 changes: 2 additions & 2 deletions src/test/compat_incompat_features/TEST2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2017-2023, Intel Corporation
# Copyright 2017-2024, Intel Corporation
#
#
# compat_incompat_features/TEST2 -- test for compat/incompat feature flags
Expand All @@ -9,7 +9,7 @@
# than poolset options
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium
require_fs_type any
Expand Down
4 changes: 2 additions & 2 deletions src/test/compat_incompat_features/TEST3
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2017-2023, Intel Corporation
# Copyright 2017-2024, Intel Corporation
#
#
# compat_incompat_features/TEST3 -- test for compat/incompat feature flags
#
# check if pool fails to open when incompat flags differ between parts
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium
require_fs_type any
Expand Down
4 changes: 2 additions & 2 deletions src/test/compat_incompat_features/TEST4
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2017-2023, Intel Corporation
# Copyright 2017-2024, Intel Corporation
#
#
# compat_incompat_features/TEST4 -- test for compat/incompat feature flags
#
# check if pool fails to open when incompat flags do not match poolset options
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium
require_fs_type any
Expand Down
2 changes: 1 addition & 1 deletion src/test/ctl_cow/TEST0
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# for obj pool
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium
require_command md5sum
Expand Down
2 changes: 1 addition & 1 deletion src/test/ctl_cow/TEST3
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# on Device DAX when copy_on_write.at_open=1 fails
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium
require_dax_devices 1
Expand Down
4 changes: 2 additions & 2 deletions src/test/ctl_prefault/TEST0
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2018-2023, Intel Corporation
# Copyright 2018-2024, Intel Corporation

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type short

Expand Down
4 changes: 2 additions & 2 deletions src/test/daxio/TEST0
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2018-2019, Intel Corporation
# Copyright 2018-2024, Intel Corporation
#
#
# daxio/TEST0 -- test for daxio utility; basic functionality
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium
require_fs_type any
Expand Down
4 changes: 2 additions & 2 deletions src/test/daxio/TEST1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2018-2019, Intel Corporation
# Copyright 2018-2024, Intel Corporation
#
#
# daxio/TEST1 -- test for daxio utility; negative scenarios
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium
require_fs_type any
Expand Down
4 changes: 2 additions & 2 deletions src/test/daxio/TEST2
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2018-2019, Intel Corporation
# Copyright 2018-2024, Intel Corporation
#
#
# daxio/TEST2 -- test for daxio utility; move data between two devices

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium
require_fs_type any
Expand Down
4 changes: 2 additions & 2 deletions src/test/daxio/TEST3
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2018-2019, Intel Corporation
# Copyright 2018-2024, Intel Corporation
#
#
# daxio/TEST3 -- test for daxio utility; exactly the same as TEST0,
# but using various size units (KB, KiB, K, B, ...)
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium
require_fs_type any
Expand Down
4 changes: 2 additions & 2 deletions src/test/ex_libpmem/TEST0
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
#
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2015-2023, Intel Corporation
# Copyright 2015-2024, Intel Corporation
#
# Copyright (c) 2016, Microsoft Corporation. All rights reserved.
#
Expand Down Expand Up @@ -38,7 +38,7 @@
# src/test/ex_libpmem/TEST0 -- unit test for libpmem examples
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium

Expand Down
4 changes: 2 additions & 2 deletions src/test/ex_libpmem/TEST1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
#
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2015-2019, Intel Corporation
# Copyright 2015-2024, Intel Corporation
#
# Copyright (c) 2016, Microsoft Corporation. All rights reserved.
#
Expand Down Expand Up @@ -38,7 +38,7 @@
# src/test/ex_libpmem/TEST1 -- unit test for libpmem examples
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium

Expand Down
2 changes: 1 addition & 1 deletion src/test/ex_libpmemobj/TEST0
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# src/test/ex_libpmemobj/TEST0 -- unit test for libpmemobj examples
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium
require_build_type debug nondebug
Expand Down
2 changes: 1 addition & 1 deletion src/test/ex_libpmemobj/TEST1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# src/test/ex_libpmemobj/TEST1 -- unit test for libpmemobj examples
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium

Expand Down
4 changes: 2 additions & 2 deletions src/test/ex_libpmemobj/TEST15
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2015-2023, Intel Corporation
# Copyright 2015-2024, Intel Corporation

#
# src/test/ex_libpmemobj/TEST15 -- unit test for libpmemobj examples
# This test is not run on GH Actions, as it requires
# connecting a terminal to standard output.
#

. ../unittest/unittest.sh
. ../_unittest/unittest.sh

require_test_type medium

Expand Down
Loading