Browse Source

Test: utils.cc - move sleep_millis() to std_utils.cc

LIB-11
heck 4 years ago
parent
commit
9f579de001
  1. 5
      test/framework/utils.cc
  2. 1
      test/framework/utils.hh
  3. 5
      test/pitytest11/test/test_execmodes.cc
  4. 1
      test/pitytest11/test/test_processdirs.cc
  5. 5
      test/pitytest11/test/test_transport.cc

5
test/framework/utils.cc

@ -1,7 +1,2 @@
#include "utils.hh"
void sleep_millis(int milis) {
std::chrono::milliseconds timespan(milis);
std::this_thread::sleep_for(timespan);
}

1
test/framework/utils.hh

@ -70,6 +70,5 @@
// ------------------------------------------------------------------------------------------------
void sleep_millis(int milis);
#endif // LIBPEPADAPTER_TEST_UTILS_HH

5
test/pitytest11/test/test_execmodes.cc

@ -1,8 +1,9 @@
#include "../src/PityUnit.hh"
#include "../../framework/utils.hh"
#include "../../../src/std_utils.hh"
#include <iostream>
using namespace std;
using namespace pEp;
using namespace pEp::PityTest11;
void do_some_work(const PityUnit<>& myself, int sleepmilis, int rep_count)
@ -10,7 +11,7 @@ void do_some_work(const PityUnit<>& myself, int sleepmilis, int rep_count)
int i = 0;
while (i < rep_count) {
myself.log(myself.getName() + " - " + to_string(i));
sleep_millis(sleepmilis);
Utils::sleep_millis(sleepmilis);
i++;
}
}

1
test/pitytest11/test/test_processdirs.cc

@ -1,5 +1,4 @@
#include "../src/PityUnit.hh"
#include "../../framework/utils.hh"
#include <iostream>
#include <algorithm>

5
test/pitytest11/test/test_transport.cc

@ -1,5 +1,4 @@
#include "../src/PityUnit.hh"
#include "../../framework/utils.hh"
#include "../../../src/std_utils.hh"
#include <iostream>
#include <fstream>
@ -16,7 +15,7 @@ void send(const PityUnit<>& myself)
ofstream msgfile = Utils::file_create(myself.processDir() + "/transport.msg");
msgfile << "G4rbage" << endl;
msgfile.close();
sleep_millis(400000);
Utils::sleep_millis(400000);
}
void receive(const PityUnit<>& myself)
@ -24,7 +23,7 @@ void receive(const PityUnit<>& myself)
setenv("HOME", myself.processDir().c_str(), 1);
myself.log("HOME=" + string(getenv("HOME")));
// Utils::dir_list_files()
sleep_millis(400000);
Utils::sleep_millis(400000);
}
int main(int argc, char* argv[])

Loading…
Cancel
Save