Skip to content

Commit

Permalink
CPUPL-560 : libFLAME modified Makefile to handle make check.
Browse files Browse the repository at this point in the history
On running "make check LIBBLAS=<Full path-to-BLIS-library including the library>"
Change-Id: I2c1219407395bdb4ac86604dcaea2e48fcad295c
  • Loading branch information
jagar authored and Jagadish1 R committed Nov 24, 2020
1 parent 2cfd055 commit 4967371
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 1 deletion.
46 changes: 45 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
libs libflame \
check-env check-env-config check-env-fragments \
flat-headers \
test \
test check checklibflame\
checkcpp cleancpptest \
install-headers install-libs install-lib-symlinks \
clean cleanmk cleanh cleanlib cleanleaves distclean \
Expand Down Expand Up @@ -59,6 +59,7 @@ OBJ_DIR := obj
LIB_DIR := lib
INC_DIR := include
LAPACKE_DIR := lapacke
TEST_DIR := test
CPP_TEST_DIR := testcpp

# Use the system type to name the config, object, and library directories.
Expand Down Expand Up @@ -428,6 +429,8 @@ all: libs

libs: libflame

check: checklibflame

install: libs install-libs install-lib-symlinks install-headers

uninstall: uninstall-libs uninstall-lib-symlinks uninstall-headers
Expand Down Expand Up @@ -656,9 +659,50 @@ endif

# --- Test suite rules ---

# The test binary executable filename.
#
# $(TEST_WRAPPER) ./$(TEST_BIN) ... > $(TEST_OUT_FILE)
#
# "TEST_WRAPPER can be used to set additional environment variables
# such as LD_LIBRARY_PATH, numactl and others"
#
TEST_BIN := test_$(LIBFLAME).x
TEST_WRAPPER ?=
TEST_CHECK := check-flametest.sh

# The location of the script that checks the BLIS testsuite output.
TEST_CHECK_PATH := $(DIST_PATH)/$(TEST_DIR)/$(TEST_CHECK)

test-bin: check-env $(TEST_BIN)

TEST_OUT_FILE := output.test

# Check the results of the LIBLFLAME tests.
$(TEST_BIN):
ifeq ($(ENABLE_VERBOSE),yes)
$(MAKE) -C $(TEST_DIR)
else
@$(MAKE) -C $(TEST_DIR)
endif

test-run: test-bin
ifeq ($(ENABLE_VERBOSE),yes)
cd $(TEST_DIR) && $(TEST_WRAPPER) ./$(TEST_BIN) > $(TEST_OUT_FILE)
else
@echo "Running $(TEST_BIN) with output redirected to '$(TEST_OUT_FILE)'"
@chmod +x $(TEST_DIR)/$(TEST_CHECK)
@echo "Please wait for tests to complete..."
@cd $(TEST_DIR) && $(TEST_WRAPPER) ./$(TEST_BIN) > $(TEST_OUT_FILE)
endif

checklibflame:test-run
ifeq ($(ENABLE_VERBOSE),yes)
- $(TEST_CHECK_PATH) $(TEST_DIR)/$(TEST_OUT_FILE)
else
- $(TEST_CHECK_PATH) $(TEST_DIR)/$(TEST_OUT_FILE)
endif


# --- Install rules ---


Expand Down
53 changes: 53 additions & 0 deletions test/check-flametest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/sh
#
# LIBFLAME
# An object-based framework for developing high-performance BLAS-like
# libraries.
#
# Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# - Neither the name(s) of the copyright holder(s) nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#

script_name=${0##*/}

ansi_red="\033[0;31m" #prints the message on console in red
ansi_green="\033[0;32m" #prints the message on console in green
ansi_normal="\033[0m"

passmsg="All LIBFLAME tests passed!"
failmsg="Please see output.test for details."

grep -q FAILURE $1

if [ $? -eq 0 ]; then
printf "${ansi_red}""${script_name}: ${failmsg}""${ansi_normal}\n"
exit 1
else
printf "${ansi_green}""${script_name}: ${passmsg}""${ansi_normal}\n"
exit 0
fi

0 comments on commit 4967371

Please sign in to comment.