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
48b2c661
Commit
48b2c661
authored
Nov 30, 2023
by
Tijana Vukovic
Browse files
Added get current working directory function
parent
d4c02429
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
test/parent_process.cpp
test/parent_process.cpp
+20
-5
No files found.
test/parent_process.cpp
View file @
48b2c661
...
...
@@ -7,12 +7,26 @@
#include <migraphx/process.hpp>
#include <migraphx/filesystem.hpp>
#include <migraphx/errors.hpp>
#include <tchar.h>
#define BUFSIZE MAX_PATH
std
::
string
get_cwd
()
{
char
Buffer
[
BUFSIZE
];
DWORD
dwRet
;
dwRet
=
GetCurrentDirectory
(
BUFSIZE
,
Buffer
);
if
(
dwRet
==
0
)
MIGRAPHX_THROW
(
"GetCurrentDirectory failed ("
+
std
::
to_string
(
GetLastError
())
+
")"
);
return
std
::
string
(
Buffer
);
}
TEST_CASE
(
string_data
)
{
auto
child_path
=
migraphx
::
fs
::
path
{
"C:/develop/AMDMIGraphX/build/bin"
};
std
::
string
cwd
=
get_cwd
();
auto
child_path
=
migraphx
::
fs
::
path
{
cwd
};
std
::
string
string_data
=
"Parent string
\0
"
;
std
::
string
string_data
=
"Parent string"
;
// write string data to child process
migraphx
::
process
{
"test_child.exe"
}.
cwd
(
child_path
).
write
([
&
](
auto
writer
)
{
...
...
@@ -28,13 +42,13 @@ TEST_CASE(string_data)
// 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);
}
...
...
@@ -44,7 +58,8 @@ 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"
};
std
::
string
cwd
=
get_cwd
();
auto
child_path
=
migraphx
::
fs
::
path
{
cwd
};
// write string data to child process
migraphx
::
process
{
"test_child.exe"
}.
cwd
(
child_path
).
write
([
&
](
auto
writer
)
{
...
...
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