Skip to content

Commit

Permalink
fix transfers in autotester
Browse files Browse the repository at this point in the history
  • Loading branch information
adriweb committed Sep 26, 2024
1 parent 2198497 commit 3024716
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions tests/autotester/autotester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,9 @@ std::vector<std::string> globVector(const std::string& pattern)

bool sendFilesForTest()
{
int linkRet;
bool transfersDone = false;
std::vector<const char*> files;
std::vector<std::string> forced_files;
const char* forced_libs_group = getenv("AUTOTESTER_LIBS_GROUP");
const char* forced_libs_dir = getenv("AUTOTESTER_LIBS_DIR");
Expand Down Expand Up @@ -680,44 +683,45 @@ bool sendFilesForTest()
{
if (debugMode)
{
std::cout << "- Sending forced file " << file << "... ";
}
if (cemucore::emu_send_variable(file.c_str(), cemucore::LINK_FILE) != cemucore::LINK_GOOD)
{
if (debugMode)
{
std::cout << std::endl;
}
std::cerr << "[Error] Forced file couldn't be sent" << std::endl;
return false;
}
if (debugMode)
{
std::cout << "[OK]" << std::endl;
std::cout << "- Will send forced file " << file << "... ";
}
files.push_back(strdup(file.c_str()));
}
}

for (const auto& file : config.transfer_files)
{
if (debugMode)
{
std::cout << "- Sending file " << file << "... ";
std::cout << "- Will send file " << file << "... " << std::endl;
}
if (cemucore::emu_send_variable(file.c_str(), cemucore::LINK_FILE) != cemucore::LINK_GOOD)
{
if (debugMode)
{
std::cout << std::endl;
files.push_back(file.c_str());
}

linkRet = cemucore::emu_send_variables(files.data(), files.size(), cemucore::LINK_FILE, [](void* done, int value, int total) {
if (total) {
if (debugMode && (value % 10 == 0)) {
std::cout << " transfer progress: " << value << "/" << total << std::endl;
}
std::cerr << "[Error] File couldn't be sent" << std::endl;
return false;
} else {
std::cerr << " transfer issue" << std::endl;
}
if (debugMode)

*(bool*)done = (value == total);
return false;
}, &transfersDone);

if (linkRet == cemucore::LINK_ERR)
{
std::cerr << " emu_send_variables error" << std::endl;
} else {
while (!transfersDone)
{
std::cout << "[OK]" << std::endl;
cemucore::emu_run(1000);
}
cemucore::emu_run(1000);
}

return true;
}

Expand Down

0 comments on commit 3024716

Please sign in to comment.