From edc9e07c4bf43e80e1e38acf63a0177bc08b382d Mon Sep 17 00:00:00 2001 From: heister Date: Thu, 25 Aug 2011 16:34:19 +0000 Subject: [PATCH] make test more reliable by moving the temporary files into the ncpu_* directory. This way the test can be run at the same time for different cpu counts. git-svn-id: https://svn.dealii.org/trunk@24201 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/mpi/no_flux_constraints_02.cc | 15 ++++++++------- .../mpi/no_flux_constraints_02/ncpu_1/cmp/generic | 2 +- .../mpi/no_flux_constraints_02/ncpu_9/cmp/generic | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/mpi/no_flux_constraints_02.cc b/tests/mpi/no_flux_constraints_02.cc index 219d903588..5001a20aeb 100644 --- a/tests/mpi/no_flux_constraints_02.cc +++ b/tests/mpi/no_flux_constraints_02.cc @@ -120,15 +120,16 @@ void test() MappingQ(degree));*/ constraints.close(); + std::string base = output_file_for_mpi("no_flux_constraints_02"); + if (myid==0) - system("rm -rf no_flux_constraints_02/cm_?.dot"); + system(("rm -rf " + base + "cm_?.dot").c_str()); MPI_Barrier(MPI_COMM_WORLD); { //write the constraintmatrix to a file on each cpu - char fname[] = "no_flux_constraints_02/cm_0.dot"; - fname[26]+=myid; - std::ofstream file(fname); + std::string fname = base+"cm_" + Utilities::int_to_string(myid) + ".dot"; + std::ofstream file(fname.c_str()); constraints.print(file); } MPI_Barrier(MPI_COMM_WORLD); @@ -137,10 +138,10 @@ void test() { //sort and merge the constraint matrices on proc 0, generate a checksum //and output that into the deallog - system("cat no_flux_constraints_02/cm_?.dot|sort -n|uniq >no_flux_constraints_02/cm"); - system("md5sum no_flux_constraints_02/cm >no_flux_constraints_02/cm.check"); + system((std::string("cat ") + base+"cm_?.dot|sort -n|uniq >" + base+"cm").c_str()); + system((std::string("md5sum ") + base + "cm >" + base + "cm.check").c_str()); { - std::ifstream file("no_flux_constraints_02/cm.check"); + std::ifstream file((base+"cm.check").c_str()); std::string str; while (!file.eof()) { diff --git a/tests/mpi/no_flux_constraints_02/ncpu_1/cmp/generic b/tests/mpi/no_flux_constraints_02/ncpu_1/cmp/generic index 771f7b978f..b8aedf6cb3 100644 --- a/tests/mpi/no_flux_constraints_02/ncpu_1/cmp/generic +++ b/tests/mpi/no_flux_constraints_02/ncpu_1/cmp/generic @@ -2,7 +2,7 @@ DEAL:0:3d::# flagged cells = 224 DEAL:0:3d::#cells = 7712 DEAL:0:3d::#dofs = 27018 -DEAL:0:3d::8d31dbb7fcfab0b5578ba30b9d2e982c no_flux_constraints_02/cm +DEAL:0:3d::8d31dbb7fcfab0b5578ba30b9d2e982c no_flux_constraints_02/ncpu_1/outputcm DEAL:0:3d:: DEAL:0:3d::#constraints on 0: 2088 DEAL:0:3d::OK diff --git a/tests/mpi/no_flux_constraints_02/ncpu_9/cmp/generic b/tests/mpi/no_flux_constraints_02/ncpu_9/cmp/generic index a9c78f0d1c..d7107b9f5b 100644 --- a/tests/mpi/no_flux_constraints_02/ncpu_9/cmp/generic +++ b/tests/mpi/no_flux_constraints_02/ncpu_9/cmp/generic @@ -2,7 +2,7 @@ DEAL:0:3d::# flagged cells = 224 DEAL:0:3d::#cells = 7712 DEAL:0:3d::#dofs = 27018 -DEAL:0:3d::8d31dbb7fcfab0b5578ba30b9d2e982c no_flux_constraints_02/cm +DEAL:0:3d::8d31dbb7fcfab0b5578ba30b9d2e982c no_flux_constraints_02/ncpu_9/outputcm DEAL:0:3d:: DEAL:0:3d::#constraints on 0: 39 DEAL:0:3d::#constraints on 1: 771 -- 2.39.5