[hit] Remove CUSTOM_CMD

Change-Id: Ia156fe6aab9cfcc11284823ea5131e33eaf962bc


[ROCm/clr commit: db52b0f60f]
This commit is contained in:
Maneesh Gupta
2019-04-08 16:13:07 +05:30
rodzic 74110bbd43
commit 68cf672441
3 zmienionych plików z 6 dodań i 47 usunięć
-12
Wyświetl plik
@@ -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:
```
ctest
@@ -155,20 +155,6 @@ macro(HIT_ADD_FILES _dir _label _parent)
endif()
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
execute_process(COMMAND ${HIP_SRC_PATH}/tests/hit/parser --testCMDs ${file}
OUTPUT_VARIABLE _contents
+6 -21
Wyświetl plik
@@ -8,7 +8,7 @@ use File::Spec;
sub parse_file {
my $file = shift;
(my $exe = $file) =~ s/\.[^.]+$//g;
my (@buildCMDs, @testCMDs, @testNamedCMDs, @cmakeCMDs);
my (@buildCMDs, @testCMDs, @testNamedCMDs);
if (open (SOURCE, '<:encoding(UTF-8)', "$file")) {
while (<SOURCE>) {
my $line=$_;
@@ -36,17 +36,10 @@ sub parse_file {
$line =~ s/\R//g; # Remove line endings
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);
}
return (\@buildCMDs, \@testCMDs, \@testNamedCMDs, \@cmakeCMDs);
return (\@buildCMDs, \@testCMDs, \@testNamedCMDs);
}
# Exit if no arguments specified
@@ -60,9 +53,8 @@ my @options = ();
my $retBuildCMDs = 0;
my $retTestCMDs = 0;
my $retTestNamedCMDs = 0;
my $retCmakeCMDs = 0;
foreach $arg (@ARGV) {
if ($retBuildCMDs or $retTestCMDs or $retTestNamedCMDs or $retCmakeCMDs) {
if ($retBuildCMDs or $retTestCMDs or $retTestNamedCMDs) {
push (@options, $arg);
}
if ($arg eq '--buildCMDs') {
@@ -74,21 +66,18 @@ foreach $arg (@ARGV) {
if ($arg eq '--testNamedCMDs') {
$retTestNamedCMDs = 1;
}
if ($arg eq '--cmakeCMDs') {
$retCmakeCMDs = 1;
}
}
# Atleast one command needs to be specified
if (($retBuildCMDs eq 0) and ($retTestCMDs eq 0) and ($retTestNamedCMDs eq 0) and ($retCmakeCMDs eq 0)) {
die "Usage: $0 <--buildCMDs|--testCMDs|--testNamedCMDs|--cmakeCMDs> FILENAMEs\n";
if (($retBuildCMDs eq 0) and ($retTestCMDs eq 0) and ($retTestNamedCMDs eq 0)) {
die "Usage: $0 <--buildCMDs|--testCMDs|--testNamedCMDs> FILENAMEs\n";
}
# Iterate over input files
foreach $file (@options) {
# Convert absolute path to path relative to working directory
my $relfile = File::Spec->abs2rel($file);
my ($buildCMDs, $testCMDs, $testNamedCMDs, $cmakeCMDs) = parse_file("$relfile");
my ($buildCMDs, $testCMDs, $testNamedCMDs) = parse_file("$relfile");
if ($retBuildCMDs) {
# print "BuildCMDs:\n";
print "$_\n" for @$buildCMDs;
@@ -101,10 +90,6 @@ foreach $file (@options) {
# print "TestNamedCMDs:\n";
print "$_\n" for @$testNamedCMDs;
}
if ($retCmakeCMDs) {
# print "CmakeCMDs:\n";
print "$_\n" for @$cmakeCMDs;
}
}
# vim: ts=4:sw=4:expandtab:smartindent