[hit] Remove CUSTOM_CMD
Change-Id: Ia156fe6aab9cfcc11284823ea5131e33eaf962bc
[ROCm/clr commit: db52b0f60f]
This commit is contained in:
@@ -75,18 +75,6 @@ TEST: %t CMAKE_TEST_NAME <arguments_to_test_executable> EXCLUDE_HIP_PLATFORM <hc
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### CMAKECMD command
|
|
||||||
|
|
||||||
The supported syntax for the CMAKECMD command is:
|
|
||||||
```
|
|
||||||
CMAKECMD: <cmake_command> <options_to_cmake_command>
|
|
||||||
```
|
|
||||||
cmake_command: refers to any of the commands supported by ```cmake -E``` as specified in the [cmake documentation](https://cmake.org/cmake/help/latest/manual/cmake.1.html#command-line-tool-mode). Note that the commands are limited by the version of cmake the user is running.
|
|
||||||
options_to_cmake_command: refers to the arguments supported by the specific cmake_command. The arguments are parsed by HIT to replace special markers. The markers supported by HIT are:
|
|
||||||
%S: Refers to the source directory containing the current source file.
|
|
||||||
%B: Refers to the build directory for the current cmake project i.e. CMAKE_CURRENT_BINARY_DIR.
|
|
||||||
|
|
||||||
|
|
||||||
### Running tests:
|
### Running tests:
|
||||||
```
|
```
|
||||||
ctest
|
ctest
|
||||||
|
|||||||
@@ -155,20 +155,6 @@ macro(HIT_ADD_FILES _dir _label _parent)
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Run cmake commands
|
|
||||||
execute_process(COMMAND ${HIP_SRC_PATH}/tests/hit/parser --cmakeCMDs ${file}
|
|
||||||
OUTPUT_VARIABLE _contents
|
|
||||||
ERROR_QUIET
|
|
||||||
WORKING_DIRECTORY ${_dir}
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
string(REGEX REPLACE "\n" ";" _contents "${_contents}")
|
|
||||||
string(REGEX REPLACE "%S" ${_dir} _contents "${_contents}")
|
|
||||||
string(REGEX REPLACE "%B" ${CMAKE_CURRENT_BINARY_DIR} _contents "${_contents}")
|
|
||||||
foreach(_cmd ${_contents})
|
|
||||||
string(REGEX REPLACE " " ";" _cmd "${_cmd}")
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E ${_cmd})
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# Add tests
|
# Add tests
|
||||||
execute_process(COMMAND ${HIP_SRC_PATH}/tests/hit/parser --testCMDs ${file}
|
execute_process(COMMAND ${HIP_SRC_PATH}/tests/hit/parser --testCMDs ${file}
|
||||||
OUTPUT_VARIABLE _contents
|
OUTPUT_VARIABLE _contents
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use File::Spec;
|
|||||||
sub parse_file {
|
sub parse_file {
|
||||||
my $file = shift;
|
my $file = shift;
|
||||||
(my $exe = $file) =~ s/\.[^.]+$//g;
|
(my $exe = $file) =~ s/\.[^.]+$//g;
|
||||||
my (@buildCMDs, @testCMDs, @testNamedCMDs, @cmakeCMDs);
|
my (@buildCMDs, @testCMDs, @testNamedCMDs);
|
||||||
if (open (SOURCE, '<:encoding(UTF-8)', "$file")) {
|
if (open (SOURCE, '<:encoding(UTF-8)', "$file")) {
|
||||||
while (<SOURCE>) {
|
while (<SOURCE>) {
|
||||||
my $line=$_;
|
my $line=$_;
|
||||||
@@ -36,17 +36,10 @@ sub parse_file {
|
|||||||
$line =~ s/\R//g; # Remove line endings
|
$line =~ s/\R//g; # Remove line endings
|
||||||
push @testNamedCMDs, $line;
|
push @testNamedCMDs, $line;
|
||||||
}
|
}
|
||||||
# Look for CMAKECMD instructions
|
|
||||||
if ($line =~ /^ \* CMAKECMD:/) {
|
|
||||||
$line =~ s/^ \* CMAKECMD: //g; # Remove " * CMAKECMD: "
|
|
||||||
# Substitute %S -> srcdir and %B -> builddir happens in cmake
|
|
||||||
$line =~ s/\R//g; # Remove line endings
|
|
||||||
push @cmakeCMDs, $line;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
close(SOURCE);
|
close(SOURCE);
|
||||||
}
|
}
|
||||||
return (\@buildCMDs, \@testCMDs, \@testNamedCMDs, \@cmakeCMDs);
|
return (\@buildCMDs, \@testCMDs, \@testNamedCMDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Exit if no arguments specified
|
# Exit if no arguments specified
|
||||||
@@ -60,9 +53,8 @@ my @options = ();
|
|||||||
my $retBuildCMDs = 0;
|
my $retBuildCMDs = 0;
|
||||||
my $retTestCMDs = 0;
|
my $retTestCMDs = 0;
|
||||||
my $retTestNamedCMDs = 0;
|
my $retTestNamedCMDs = 0;
|
||||||
my $retCmakeCMDs = 0;
|
|
||||||
foreach $arg (@ARGV) {
|
foreach $arg (@ARGV) {
|
||||||
if ($retBuildCMDs or $retTestCMDs or $retTestNamedCMDs or $retCmakeCMDs) {
|
if ($retBuildCMDs or $retTestCMDs or $retTestNamedCMDs) {
|
||||||
push (@options, $arg);
|
push (@options, $arg);
|
||||||
}
|
}
|
||||||
if ($arg eq '--buildCMDs') {
|
if ($arg eq '--buildCMDs') {
|
||||||
@@ -74,21 +66,18 @@ foreach $arg (@ARGV) {
|
|||||||
if ($arg eq '--testNamedCMDs') {
|
if ($arg eq '--testNamedCMDs') {
|
||||||
$retTestNamedCMDs = 1;
|
$retTestNamedCMDs = 1;
|
||||||
}
|
}
|
||||||
if ($arg eq '--cmakeCMDs') {
|
|
||||||
$retCmakeCMDs = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Atleast one command needs to be specified
|
# Atleast one command needs to be specified
|
||||||
if (($retBuildCMDs eq 0) and ($retTestCMDs eq 0) and ($retTestNamedCMDs eq 0) and ($retCmakeCMDs eq 0)) {
|
if (($retBuildCMDs eq 0) and ($retTestCMDs eq 0) and ($retTestNamedCMDs eq 0)) {
|
||||||
die "Usage: $0 <--buildCMDs|--testCMDs|--testNamedCMDs|--cmakeCMDs> FILENAMEs\n";
|
die "Usage: $0 <--buildCMDs|--testCMDs|--testNamedCMDs> FILENAMEs\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Iterate over input files
|
# Iterate over input files
|
||||||
foreach $file (@options) {
|
foreach $file (@options) {
|
||||||
# Convert absolute path to path relative to working directory
|
# Convert absolute path to path relative to working directory
|
||||||
my $relfile = File::Spec->abs2rel($file);
|
my $relfile = File::Spec->abs2rel($file);
|
||||||
my ($buildCMDs, $testCMDs, $testNamedCMDs, $cmakeCMDs) = parse_file("$relfile");
|
my ($buildCMDs, $testCMDs, $testNamedCMDs) = parse_file("$relfile");
|
||||||
if ($retBuildCMDs) {
|
if ($retBuildCMDs) {
|
||||||
# print "BuildCMDs:\n";
|
# print "BuildCMDs:\n";
|
||||||
print "$_\n" for @$buildCMDs;
|
print "$_\n" for @$buildCMDs;
|
||||||
@@ -101,10 +90,6 @@ foreach $file (@options) {
|
|||||||
# print "TestNamedCMDs:\n";
|
# print "TestNamedCMDs:\n";
|
||||||
print "$_\n" for @$testNamedCMDs;
|
print "$_\n" for @$testNamedCMDs;
|
||||||
}
|
}
|
||||||
if ($retCmakeCMDs) {
|
|
||||||
# print "CmakeCMDs:\n";
|
|
||||||
print "$_\n" for @$cmakeCMDs;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# vim: ts=4:sw=4:expandtab:smartindent
|
# vim: ts=4:sw=4:expandtab:smartindent
|
||||||
|
|||||||
Reference in New Issue
Block a user