@@ -53,6 +53,8 @@ using random_bytes_engine =
53
53
unsigned int >;
54
54
namespace fs = std::experimental::filesystem::v1;
55
55
56
+ int tmpCount = 0 ;
57
+
56
58
static void l_remove_file (const char *filename) {
57
59
#ifdef _WIN32
58
60
_unlink (filename);
@@ -469,8 +471,9 @@ static bool is_same_tmpdir(const std::vector<fs::path> &files,
469
471
470
472
TEST (package, unpack) {
471
473
int result;
472
- fs::path tmpdir = " tmp" ;
473
- std::string tmpdir_string = tmpdir.string ();
474
+ std::string tmpdir_string = " tmp" + std::to_string (tmpCount);
475
+ tmpCount++;
476
+ fs::path tmpdir = tmpdir_string;
474
477
const char *tmpdir_c_str = tmpdir_string.c_str ();
475
478
std::vector<fs::path> files = generate_tmp_folder (tmpdir);
476
479
@@ -485,12 +488,14 @@ TEST(package, unpack) {
485
488
486
489
// Compare some files to be sure that they are the same.
487
490
CHECK (is_same_tmpdir (files, PACK_UNPACK_DIR));
491
+ system ((" rm -rf " + tmpdir_string).c_str ());
488
492
}
489
493
490
494
TEST (package, unpack_buffer) {
491
495
int result;
492
- fs::path tmpdir = " tmp" ;
493
- std::string tmpdir_string = tmpdir.string ();
496
+ std::string tmpdir_string = " tmp" + std::to_string (tmpCount);
497
+ tmpCount++;
498
+ fs::path tmpdir = tmpdir_string;
494
499
const char *tmpdir_c_str = tmpdir_string.c_str ();
495
500
std::vector<fs::path> files = generate_tmp_folder (tmpdir);
496
501
// Create a known good input.
@@ -521,12 +526,14 @@ TEST(package, unpack_buffer) {
521
526
CHECK_EQUAL (true , files_same (" test/pkg_editor_test.cpp" ,
522
527
PACK_UNPACK_DIR " /test/pkg_editor_test.cpp" ));
523
528
CHECK (is_same_tmpdir (files, PACK_UNPACK_DIR));
529
+ system ((" rm -rf " + tmpdir_string).c_str ());
524
530
}
525
531
526
532
TEST (package, unpack_buffer_stdin) {
527
533
int result;
528
- fs::path tmpdir = " tmp" ;
529
- std::string tmpdir_string = tmpdir.string ();
534
+ std::string tmpdir_string = " tmp" + std::to_string (tmpCount);
535
+ tmpCount++;
536
+ fs::path tmpdir = tmpdir_string;
530
537
const char *tmpdir_c_str = tmpdir_string.c_str ();
531
538
std::vector<fs::path> files = generate_tmp_folder (tmpdir);
532
539
@@ -579,5 +586,6 @@ TEST(package, unpack_buffer_stdin) {
579
586
CHECK_EQUAL (true , files_same (" test/pkg_editor_test.cpp" ,
580
587
PACK_UNPACK_DIR " /test/pkg_editor_test.cpp" ));
581
588
CHECK (is_same_tmpdir (files, PACK_UNPACK_DIR));
589
+ system ((" rm -rf " + tmpdir_string).c_str ());
582
590
}
583
591
#endif
0 commit comments