-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
smoke test for NFsim runs with bash and python3 on all platforms
- Loading branch information
Showing
12 changed files
with
227 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# time O0_MT0_tot_Count O0_MT1_tot_Count O0_MT2_tot_Count O0_MT3_tot_Count O0_MT4_tot_Count s0_Count s1_Count s2_Count s3_Count s4_Count | ||
0.00000000e+00 6.02000000e+02 9.03000000e+02 1.20400000e+03 0.00000000e+00 0.00000000e+00 6.02000000e+02 9.03000000e+02 1.20400000e+03 0.00000000e+00 0.00000000e+00 | ||
1.00000000e-01 5.37000000e+02 9.68000000e+02 1.13900000e+03 0.00000000e+00 0.00000000e+00 5.37000000e+02 9.68000000e+02 1.13900000e+03 0.00000000e+00 0.00000000e+00 | ||
2.00000000e-01 5.24000000e+02 9.81000000e+02 1.12600000e+03 0.00000000e+00 0.00000000e+00 5.24000000e+02 9.81000000e+02 1.12600000e+03 0.00000000e+00 0.00000000e+00 | ||
3.00000000e-01 5.23000000e+02 9.82000000e+02 1.12500000e+03 0.00000000e+00 0.00000000e+00 5.23000000e+02 9.82000000e+02 1.12500000e+03 0.00000000e+00 0.00000000e+00 | ||
4.00000000e-01 5.30000000e+02 9.75000000e+02 1.13200000e+03 0.00000000e+00 0.00000000e+00 5.30000000e+02 9.75000000e+02 1.13200000e+03 0.00000000e+00 0.00000000e+00 | ||
5.00000000e-01 5.23000000e+02 9.82000000e+02 1.12500000e+03 0.00000000e+00 0.00000000e+00 5.23000000e+02 9.82000000e+02 1.12500000e+03 0.00000000e+00 0.00000000e+00 | ||
6.00000000e-01 5.21000000e+02 9.84000000e+02 1.12300000e+03 0.00000000e+00 0.00000000e+00 5.21000000e+02 9.84000000e+02 1.12300000e+03 0.00000000e+00 0.00000000e+00 | ||
7.00000000e-01 5.20000000e+02 9.85000000e+02 1.12200000e+03 0.00000000e+00 0.00000000e+00 5.20000000e+02 9.85000000e+02 1.12200000e+03 0.00000000e+00 0.00000000e+00 | ||
8.00000000e-01 5.13000000e+02 9.92000000e+02 1.11500000e+03 0.00000000e+00 0.00000000e+00 5.13000000e+02 9.92000000e+02 1.11500000e+03 0.00000000e+00 0.00000000e+00 | ||
9.00000000e-01 5.13000000e+02 9.92000000e+02 1.11500000e+03 0.00000000e+00 0.00000000e+00 5.13000000e+02 9.92000000e+02 1.11500000e+03 0.00000000e+00 0.00000000e+00 | ||
1.00000000e+00 5.33000000e+02 9.72000000e+02 1.13500000e+03 0.00000000e+00 0.00000000e+00 5.33000000e+02 9.72000000e+02 1.13500000e+03 0.00000000e+00 0.00000000e+00 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# nfsim generated species list for system: 'nameless' | ||
# warning! this feature is not yet fully tested! | ||
MT0(AAA~c0,AAB~0) 532 | ||
MT1(AAA~c0,AAB~0) 973 | ||
MT2(AAA~c0,AAB~0) 1134 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import posixpath | ||
import subprocess | ||
import sys | ||
|
||
# get the directory of this script | ||
test_dir = os.path.dirname(os.path.realpath(__file__)) | ||
# in the path replace \ with /, D:\ with /d/ | ||
test_dir = test_dir.replace("\\", "/") | ||
# tell os.path.join to use / as the path separator | ||
os.path.sep = "/" | ||
exe = sys.argv[1] | ||
|
||
print(f"test_dir: {test_dir}") | ||
print(f"exe: {exe}") | ||
|
||
input_file = posixpath.join(test_dir, "SimID_273069657_0_.nfsimInput") | ||
output = posixpath.join(test_dir, "SimID_273069657_0_.gdat") | ||
expected_output = posixpath.join(test_dir, "SimID_273069657_0_.gdat.expected") | ||
species = posixpath.join(test_dir, "SimID_273069657_0_.species") | ||
expected_species = posixpath.join(test_dir, "SimID_273069657_0_.species.expected") | ||
|
||
if not posixpath.exists(exe): | ||
print(f"NFsim executable {exe} not found. Exiting...") | ||
sys.exit(1) | ||
|
||
if not posixpath.exists(input_file): | ||
print(f"Input file {input_file} not found. Exiting...") | ||
sys.exit(1) | ||
|
||
if not posixpath.exists(expected_output): | ||
print(f"Expected output file {expected_output} not found. Exiting...") | ||
sys.exit(1) | ||
|
||
if not posixpath.exists(expected_species): | ||
print(f"Expected species file {expected_species} not found. Exiting...") | ||
sys.exit(1) | ||
|
||
command = [exe, "-seed", "505790288", "-vcell", "-xml", input_file, "-o", output, "-sim", "1.0", "-ss", species, "-oStep", "20", "-notf", "-utl", "1000", "-cb", "-pcmatch", "-tid", "0"] | ||
print(" ".join(command)) | ||
|
||
try: | ||
subprocess.check_call(command) | ||
except subprocess.CalledProcessError: | ||
print("NFsim failed to run. Exiting...") | ||
sys.exit(1) | ||
|
||
# verify that the output files exist | ||
if not os.path.isfile(output): | ||
print(f"Output file {output} not found. Exiting...") | ||
sys.exit(1) | ||
|
||
if not os.path.isfile(species): | ||
print(f"Species file {species} not found. Exiting...") | ||
sys.exit(1) | ||
|
||
# verify that the output files match the expected output files | ||
if open(output).read() != open(expected_output).read(): | ||
print(f"Output file {output} does not match expected output {expected_output}. Exiting...") | ||
sys.exit(1) | ||
|
||
if open(species).read() != open(expected_species).read(): | ||
print(f"Species file {species} does not match expected species {expected_species}. Exiting...") | ||
sys.exit(1) | ||
|
||
print("NFsim solver completed and solution matched expected output. Exiting...") | ||
sys.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
set -e | ||
EXE=$1 | ||
|
||
echo "Running NFsim solver with test2.sh $EXE" | ||
|
||
# get the directory of this script | ||
TEST_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
INPUT="${TEST_DIR}/SimID_273069657_0_.nfsimInput" | ||
OUTPUT="${TEST_DIR}/SimID_273069657_0_.gdat" | ||
EXPECTED_OUTPUT="${TEST_DIR}/SimID_273069657_0_.gdat.expected" | ||
SPECIES="${TEST_DIR}/SimID_273069657_0_.species" | ||
EXPECTED_SPECIES="${TEST_DIR}/SimID_273069657_0_.species.expected" | ||
|
||
if [ ! -f $EXE ]; then | ||
echo "NFsim executable $EXE not found. Exiting..." | ||
exit 1 | ||
fi | ||
if [ ! -f $INPUT ]; then | ||
echo "Input file $INPUT not found. Exiting..." | ||
exit 1 | ||
fi | ||
if [ ! -f $EXPECTED_OUTPUT ]; then | ||
echo "Expected output file $EXPECTED_OUTPUT not found. Exiting..." | ||
exit 1 | ||
fi | ||
if [ ! -f $EXPECTED_SPECIES ]; then | ||
echo "Expected species file $EXPECTED_SPECIES not found. Exiting..." | ||
exit 1 | ||
fi | ||
|
||
|
||
command="$EXE -seed 505790288 -vcell -xml $INPUT -o $OUTPUT -sim 1.0 -ss $SPECIES -oStep 20 -notf -utl 1000 -cb -pcmatch -tid 0" | ||
echo $command | ||
if ! $command; then | ||
echo "NFsim failed to run. Exiting..." | ||
exit 1 | ||
fi | ||
|
||
# verify that the output files exist | ||
if [ ! -f $OUTPUT ]; then | ||
echo "Output file $OUTPUT not found. Exiting..." | ||
exit 1 | ||
fi | ||
if [ ! -f $SPECIES ]; then | ||
echo "Species file $SPECIES not found. Exiting..." | ||
exit 1 | ||
fi | ||
|
||
# verify that the output files match the expected output files | ||
if ! diff $OUTPUT $EXPECTED_OUTPUT; then | ||
echo "Output file $OUTPUT does not match expected output $EXPECTED_OUTPUT. Exiting..." | ||
exit 1 | ||
fi | ||
if ! diff $SPECIES $EXPECTED_SPECIES; then | ||
echo "Species file $SPECIES does not match expected species $EXPECTED_SPECIES. Exiting..." | ||
exit 1 | ||
fi | ||
|
||
echo "NFsim solver complted and solution matched expected output. Exiting..." | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters