-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial checkin of new_test directory which contains a possible struc…
…ture for adding new tests
- Loading branch information
1 parent
c90cf2e
commit 8451528
Showing
15 changed files
with
4,397 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "new_test/TEST_DIR_ROOT/lib/gmsl.git"] | ||
path = new_test/TEST_DIR_ROOT/lib/gmsl.git | ||
url = [email protected]:jgrahamc/gmsl.git |
Empty file.
Empty file.
Empty file.
Empty file.
246 changes: 246 additions & 0 deletions
246
new_test/TEST_DIR_ROOT/env.testdir/invocation.testdir/help_usage.testdir/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
# vim: set tabstop=4 shiftwidth=4 noexpandtab | ||
# ==================================================================================================================== | ||
# Filename: Makefile | ||
# | ||
# Description: Makefile for building and running | ||
# | ||
# Author(s): Bill McSpadden ([email protected]) | ||
# | ||
# Revision: See git log | ||
# | ||
# ==================================================================================================================== | ||
# | ||
# SHELL is set to /bin/sh as default for make | ||
# On Ubuntu, /bin/sh is a symlink to /bin/dash | ||
# /bin/dash does not behave much like bash. | ||
# I want bash to be the shell we use in this environment, | ||
# not dash. | ||
SHELL := /bin/bash | ||
$(info SHELL: ${SHELL}) | ||
|
||
# TEST_DIR_PATH_KEYDIR is the directory name under which the | ||
# test directory exists. This directory contains the items | ||
# needed to build and run RISC-V tests. This keyword is needed | ||
# in order that this makefile and all 'included' makefiles can | ||
# find the consistent set of tools for building and running | ||
# tests. | ||
TEST_DIR_PATH_KEYDIR := TEST_DIR_ROOT | ||
|
||
# TEST_DIR_PATH is the full directory path to the current test | ||
# directory. This is an important variable for running in this | ||
# particular enviornment. | ||
TEST_DIR_PATH := $(shell \ | ||
sandbox_root=$$PWD ; \ | ||
if [[ "$$sandbox_root" =~ /${TEST_DIR_PATH_KEYDIR}/ ]] ; \ | ||
then \ | ||
while [ ! `basename $$sandbox_root` == ${TEST_DIR_PATH_KEYDIR} ] ; \ | ||
do \ | ||
sandbox_root=`dirname $$sandbox_root`; \ | ||
if [[ $sandbox_root == "/" ]] ; \ | ||
then \ | ||
echo "NULL" ; \ | ||
break ; \ | ||
fi; \ | ||
done ; \ | ||
echo "$$sandbox_root" ; \ | ||
else \ | ||
echo "NULL" ; \ | ||
fi; \ | ||
) | ||
|
||
$(info TEST_DIR_PATH: ${TEST_DIR_PATH}) | ||
$(info TEST_DIR_PATH realpath: $(realpath ${TEST_DIR_PATH})) | ||
$(info TEST_DIR_PATH abspath: $(abspath ${TEST_DIR_PATH})) | ||
|
||
# Use the GNU Make Standard Library. It provides a Make API | ||
# for useful data structures and functions. | ||
include ${TEST_DIR_PATH}/lib/gmsl.git/gmsl | ||
|
||
|
||
#========================================================= | ||
# A test definition | ||
|
||
ASM_FLAGS := | ||
RUN_FLAGS := -h | ||
XLEN := RV32 | ||
OBJDIR_TMP := $(strip ${XLEN} ${ASM_FLAGS} ${RUN_FLAGS}) | ||
|
||
|
||
# Create a unique objdir name for the variations of the test. | ||
# make does not do a good, general job of string processing with | ||
# spaces, so we'll use sed instead with | ||
|
||
UNIQ_TESTNAME := $(shell echo ${OBJDIR_TMP} | sed 's/ /__/g' | sed 's/-/_/g') | ||
$(info UNIQ_TESTNAME: ${UNIQ_TESTNAME}) | ||
|
||
OBJDIR := $(addsuffix .artifactdir,${UNIQ_TESTNAME}) | ||
$(info OBJDIR: ${OBJDIR}) | ||
|
||
TESTLIST := $(call set_insert,${UNIQ_TESTNAME},${TESTLIST}) | ||
$(call set,ASM_FLAGS_AA,${UNIQ_TESTNAME},${ASM_FLAGS}) | ||
$(info ASM_FLAGS: $(call get,ASM_FLAGS_AA,${UNIQ_TESTNAME})) | ||
$(call set,RUN_FLAGS_AA,${UNIQ_TESTNAME},${RUN_FLAGS}) | ||
$(info RUN_FLAGS: $(call get,RUN_FLAGS_AA,${UNIQ_TESTNAME})) | ||
$(call set,XLEN_AA,${UNIQ_TESTNAME},${XLEN}) | ||
$(info XLEN: $(call get,XLEN_AA,${UNIQ_TESTNAME})) | ||
#========================================================= | ||
|
||
#========================================================= | ||
# A test definition | ||
|
||
C_SRC := $(wildcard *.c) | ||
C_OBJS := $(subst .c,.o,${C_SRC}) | ||
CC_FLAGS := | ||
ASM_SRC := $(wildcard *.S *.s) | ||
ASM_OBJS := $(subst .s,.o,$(subst .S,.o,${ASM_SRC})) | ||
OBJS := ${C_OBJS} ${ASM_OBJS} | ||
ASM_FLAGS := | ||
LD_FILE := | ||
LD_FLAGS := | ||
RUN_FLAGS := -h | ||
XLEN := RV64 | ||
OBJDIR_TMP := $(strip ${XLEN} ${ASM_FLAGS} ${CC_FLAGS} ${LD_FILE} ${LD_FLAGS} ${RUN_FLAGS}) | ||
|
||
|
||
# Create a unique objdir name for the variations of the test. | ||
# make does not do a good, general job of string processing with | ||
# spaces, so we'll use sed instead with | ||
|
||
UNIQ_TESTNAME := $(shell echo ${OBJDIR_TMP} | sed 's/ /__/g' | sed 's/-/_/g') | ||
$(info UNIQ_TESTNAME: ${UNIQ_TESTNAME}) | ||
|
||
OBJDIR := $(addsuffix .artifactdir,${UNIQ_TESTNAME}) | ||
$(info OBJDIR: ${OBJDIR}) | ||
|
||
TESTLIST := $(call set_insert,${UNIQ_TESTNAME},${TESTLIST}) | ||
$(call set,ASM_FLAGS_AA,${UNIQ_TESTNAME},${ASM_FLAGS}) | ||
$(info ASM_FLAGS: $(call get,ASM_FLAGS_AA,${UNIQ_TESTNAME})) | ||
$(call set,RUN_FLAGS_AA,${UNIQ_TESTNAME},${RUN_FLAGS}) | ||
$(info RUN_FLAGS: $(call get,RUN_FLAGS_AA,${UNIQ_TESTNAME})) | ||
$(call set,XLEN_AA,${UNIQ_TESTNAME},${XLEN}) | ||
$(info XLEN: $(call get,XLEN_AA,${UNIQ_TESTNAME})) | ||
#========================================================= | ||
#========================================================= | ||
# A test definition | ||
|
||
ASM_FLAGS := | ||
RUN_FLAGS := -invalid_switch | ||
XLEN := RV64 | ||
OBJDIR_TMP := $(strip ${XLEN} ${ASM_FLAGS} ${RUN_FLAGS}) | ||
|
||
|
||
# Create a unique objdir name for the variations of the test. | ||
# make does not do a good, general job of string processing with | ||
# spaces, so we'll use sed instead with | ||
|
||
UNIQ_TESTNAME := $(shell echo ${OBJDIR_TMP} | sed 's/ /__/g' | sed 's/-/_/g') | ||
$(info UNIQ_TESTNAME: ${UNIQ_TESTNAME}) | ||
|
||
OBJDIR := $(addsuffix .artifactdir,${UNIQ_TESTNAME}) | ||
$(info OBJDIR: ${OBJDIR}) | ||
|
||
TESTLIST := $(call set_insert,${UNIQ_TESTNAME},${TESTLIST}) | ||
$(call set,ASM_FLAGS_AA,${UNIQ_TESTNAME},${ASM_FLAGS}) | ||
$(info ASM_FLAGS: $(call get,ASM_FLAGS_AA,${UNIQ_TESTNAME})) | ||
$(call set,RUN_FLAGS_AA,${UNIQ_TESTNAME},${RUN_FLAGS}) | ||
$(info RUN_FLAGS: $(call get,RUN_FLAGS_AA,${UNIQ_TESTNAME})) | ||
$(call set,XLEN_AA,${UNIQ_TESTNAME},${XLEN}) | ||
$(info XLEN: $(call get,XLEN_AA,${UNIQ_TESTNAME})) | ||
#========================================================= | ||
|
||
$(info TESTLIST: ${TESTLIST}) | ||
|
||
TESTDIRS := $(wildcard *.testdir) | ||
ARTIFACTDIRS := $(wildcard *.artifactdir) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
all: | ||
|
||
|
||
build: | ||
|
||
|
||
install: | ||
|
||
|
||
# Run in parallel (potentially, based on the -j switch to make) | ||
# TODO: also redirect stderr into test.failed | ||
.PHONY: ${TESTLIST} | ||
run_tests : ${TESTLIST} | ||
${TESTLIST} : | ||
@echo "making \"$@\"" ; | ||
@mkdir -p $@.artifactdir || ( echo "unable to create $@.artifactdir" >> test.failed ; exit $$? ; ) ; | ||
@if [ ! -e ${TEST_DIR_PATH}/../../c_emulator/riscv_sim_$(call get,XLEN_AA,$@) ] ; \ | ||
then \ | ||
echo "${TEST_DIR_PATH}/../../c_emulator/riscv_sim_$@.$(call get,XLEN_AA,$@) does not exist." >> $@.artifactdir/test.failed ; \ | ||
fi ; | ||
@${TEST_DIR_PATH}/../../c_emulator/riscv_sim_$(call get,XLEN_AA,$@) $(call get,arr_sw,$@)> $@.artifactdir/test.run.stdout ; \ | ||
if [ $$? -ne 0 ] ; \ | ||
then \ | ||
echo "riscv_sim_$@.$(call get,XLEN_AA,$@) exited with nonzero exit status" >> $@.artifactdir/test.failed ; \ | ||
fi ; | ||
@if [ ! -e $@.artifactdir/test.run.stdout ] ; \ | ||
then \ | ||
echo "file, \"$@.artifactdir/test.run.stdout\" not found" >> $@.artifactdir/test.failed ; \ | ||
fi ; | ||
@if [ ! -e $@.artifactdir/test.failed ] ; \ | ||
then \ | ||
echo "${PWD} passed" >> $@.artifactdir/test.passed ; \ | ||
fi; | ||
|
||
|
||
# Gather all the test results from this directory on down. | ||
# Do not run this target in parallel, else the output into | ||
# ./test.failed will get intermixed and become unreadable. | ||
check : | ||
@echo "$$PWD: making \"$@\"" ; | ||
@rm -f test.passed test.failed ; | ||
@for testdir in ${TESTDIRS}; \ | ||
do \ | ||
if [ ! -e $$testdir/Makefile ] ; \ | ||
then \ | ||
echo "ERROR: no Makefile in $$testdir." >> test.failed; \ | ||
fi ; \ | ||
make -C $$testdir $@ ; \ | ||
if [ $$? -ne 0 ] ; \ | ||
then \ | ||
echo "'make -C $$testdir $@' exited with nonzero exit status" >> test.failed ; \ | ||
fi ; \ | ||
done; | ||
@for artifactdir in ${ARTIFACTDIRS}; \ | ||
do \ | ||
if [ -e $$artifactdir/test.failed ] ; \ | ||
then \ | ||
echo "$$artifactdir/test.failed exists." >> test.failed; \ | ||
cat $$artifactdir/test.failed >> test.failed ; \ | ||
fi; \ | ||
if [ -e $$artifactdir/test.passed ] ; \ | ||
then \ | ||
echo "$$PWD/$$artifactdir/test.passed exists." >> test.passed; \ | ||
fi; \ | ||
if [ ! -e $$artifactdir/test.failed ] ; \ | ||
then \ | ||
if [ ! -e $$artifactdir/test.passed ] ; \ | ||
then \ | ||
echo "neither $$PWD/$$artifactdir/test.failed nor test.passed exists." >> test.failed ; \ | ||
fi ; \ | ||
fi; \ | ||
done ; | ||
|
||
|
||
|
||
clean: | ||
rm -f test.failed test.passed | ||
rm -rf *.artifactdir | ||
|
||
# Cleans local artifacts and the install location | ||
clean_all: | ||
|
||
|
||
|
40 changes: 40 additions & 0 deletions
40
new_test/TEST_DIR_ROOT/etrace.testdir/br_j_asm.testdir/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# SPDX-FileCopyrightText: Copyright 2019-2021 Siemens. All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# | ||
# 1. Redistributions of source code must retain the above copyright notice, | ||
# this list of conditions and the following disclaimer. | ||
# | ||
# 2. 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. | ||
# | ||
# 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. | ||
|
||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) | ||
|
||
find_program(CMAKE_ASM_COMPILER riscv64-unknown-elf-gcc HINTS /opt/riscv/bin) | ||
set(CMAKE_ASM_LINK_EXECUTABLE "<CMAKE_LINKER> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> -o <TARGET>") | ||
|
||
project(br_j_asm ASM) | ||
|
||
add_executable(br_j_asm.riscv test.S) | ||
|
||
set(CONFIG_BASE 0x20010000) | ||
set(CMAKE_ASM_FLAGS -DCONFIG_BASE=${CONFIG_BASE}) | ||
# If using cmake > 3.13 you could use | ||
#add_link_options(-T ${CMAKE_SOURCE_DIR}/riscv_test.ld.spike) | ||
# instead of setting LINK_FLAGS | ||
set_property(TARGET br_j_asm.riscv APPEND_STRING PROPERTY LINK_FLAGS " -T ${CMAKE_SOURCE_DIR}/riscv_test.ld.spike") |
Oops, something went wrong.