Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
767133d2
Commit
767133d2
authored
Nov 30, 2023
by
Tijana Vukovic
Browse files
Revert "Added process test"
This reverts commit
5d70c630
.
parent
5d70c630
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
107 deletions
+0
-107
test/child.cpp
test/child.cpp
+0
-32
test/parent_process.cpp
test/parent_process.cpp
+0
-75
No files found.
test/child.cpp
deleted
100644 → 0
View file @
5d70c630
#include <iostream>
#include <string>
#include <vector>
#include <Windows.h>
#include <migraphx/errors.hpp>
int
main
()
{
std
::
vector
<
char
>
result
;
HANDLE
std_in
=
GetStdHandle
(
STD_INPUT_HANDLE
);
HANDLE
std_out
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
if
(
std_in
==
INVALID_HANDLE_VALUE
)
MIGRAPHX_THROW
(
"STDIN invalid handle ("
+
std
::
to_string
(
GetLastError
())
+
")"
);
constexpr
std
::
size_t
BUFFER_SIZE
=
1024
;
DWORD
bytes_read
;
TCHAR
buffer
[
BUFFER_SIZE
];
for
(;;)
{
BOOL
status
=
ReadFile
(
std_in
,
buffer
,
BUFFER_SIZE
,
&
bytes_read
,
nullptr
);
if
(
status
==
FALSE
or
bytes_read
==
0
)
break
;
DWORD
written
;
if
(
WriteFile
(
std_out
,
buffer
,
bytes_read
,
&
written
,
nullptr
)
==
FALSE
)
break
;
//result.insert(result.end(), buffer, buffer + bytes_read);
}
//std::cout << result.data();
return
0
;
}
test/parent_process.cpp
deleted
100644 → 0
View file @
5d70c630
#include <Windows.h>
#include <iostream>
#include <string>
#include "test.hpp"
#include <migraphx/msgpack.hpp>
#include <migraphx/process.hpp>
#include <migraphx/filesystem.hpp>
#include <migraphx/errors.hpp>
TEST_CASE
(
string_data
)
{
auto
child_path
=
migraphx
::
fs
::
path
{
"C:/develop/AMDMIGraphX/build/bin"
};
std
::
string
string_data
=
"Parent string
\0
"
;
// write string data to child process
migraphx
::
process
{
"test_child.exe"
}.
cwd
(
child_path
).
write
(
[
&
](
auto
writer
)
{
migraphx
::
to_msgpack
(
string_data
,
writer
);
});
//// parent process read from child stdout
//std::vector<char> result;
//HANDLE std_in = GetStdHandle(STD_INPUT_HANDLE);
//if(std_in == INVALID_HANDLE_VALUE)
// MIGRAPHX_THROW("STDIN invalid handle (" + std::to_string(GetLastError()) + ")");
//constexpr std::size_t BUFFER_SIZE = 4096;
//DWORD bytes_read;
//TCHAR buffer[BUFFER_SIZE];
//for(;;)
//{
// BOOL status = ReadFile(std_in, buffer, BUFFER_SIZE, &bytes_read, nullptr);
// if(status == FALSE or bytes_read == 0)
// break;
// result.insert(result.end(), buffer, buffer + bytes_read);
//}
//EXPECT(result.data() == string_data);
}
TEST_CASE
(
binary_data
)
{
// binary data
std
::
vector
<
char
>
binary_data
=
{
'B'
,
'i'
,
'n'
,
'a'
,
'r'
,
'y'
};
auto
child_path
=
migraphx
::
fs
::
path
{
"C:/develop/AMDMIGraphX/build/bin"
};
// write string data to child process
migraphx
::
process
{
"test_child.exe"
}.
cwd
(
child_path
).
write
([
&
](
auto
writer
)
{
migraphx
::
to_msgpack
(
binary_data
,
writer
);
});
//// parent process read from child stdout
//std::vector<char> result;
//HANDLE std_in = GetStdHandle(STD_INPUT_HANDLE);
//if(std_in == INVALID_HANDLE_VALUE)
// MIGRAPHX_THROW("STDIN invalid handle (" + std::to_string(GetLastError()) + ")");
//constexpr std::size_t BUFFER_SIZE = 4096;
//DWORD bytes_read;
//TCHAR buffer[BUFFER_SIZE];
//for(;;)
//{
// BOOL status = ReadFile(std_in, buffer, BUFFER_SIZE, &bytes_read, nullptr);
// if(status == FALSE or bytes_read == 0)
// break;
// result.insert(result.end(), buffer, buffer + bytes_read);
//}
//EXPECT(result.data() == string_data);
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment