-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a script for generating the reference values of compiled mod files. These are included with the sources to enable the following: * during review the reviewer can see what was generated. * these can serve as golden tests, flagging changes in unrelated mod files. --------- Co-authored-by: JCGoran <[email protected]>
- Loading branch information
Showing
8 changed files
with
118 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,6 +165,33 @@ The HPC coding conventions formatter installs any dependencies into a Python | |
virtual environment. | ||
|
||
|
||
Updating Golden References | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Run | ||
|
||
.. code:: bash | ||
cmake --build <build-dir> --target generate_references | ||
to regenerate the golden references. They are saved in a submodule | ||
``tests/usecases/references``, which points to ``BlueBrain/nmodl-references``. | ||
|
||
Create a PR for the changes to the references and update the SHA in the NMODL | ||
repo. It might be useful to change to SSH authentication: | ||
|
||
.. code:: bash | ||
git remote set-url origin ssh://[email protected]/BlueBrain/nmodl-references | ||
(from inside ``tests/usecases/references``). | ||
|
||
Remember the rules of submodules: They're checked out on a specific commit, | ||
i.e. detached HEAD. If you want to modify the submodule, it's usual best to | ||
checkout ``main`` from then on the submodule will behave much like a Git repo | ||
that happens to be located inside a Git repo. | ||
|
||
|
||
Validate the Python package | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
|
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,18 @@ | ||
#! /usr/bin/env bash | ||
set -u | ||
|
||
script_dir="$(dirname "$(realpath "$0")")" | ||
nmodl="$1" | ||
usecase_dir="$2" | ||
references_dir="${script_dir}/references/$(basename "$2")" | ||
output_dir="$(mktemp -d)" | ||
|
||
"${script_dir}"/generate_references.sh ${nmodl} "${usecase_dir}" "${output_dir}" | ||
|
||
diff -U 8 -r "${references_dir}" "${output_dir}" | ||
|
||
exit_code=$? | ||
|
||
rm -r "${output_dir}" | ||
|
||
exit $exit_code |
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,33 @@ | ||
#! /usr/bin/env bash | ||
set -eu | ||
|
||
nmodl="$1" | ||
usecase_dir="$2" | ||
|
||
if [[ $# -eq 3 ]] | ||
then | ||
output_dir="$3" | ||
else | ||
script_dir="$(dirname "$(realpath "$0")")" | ||
output_dir="${script_dir}/references/$(basename "$2")" | ||
fi | ||
|
||
function sanitize() { | ||
for f in "${1}"/*.cpp | ||
do | ||
if [[ "$(uname)" == 'Darwin' ]] | ||
then | ||
sed_cmd="sed -i''" | ||
else | ||
sed_cmd="sed -i" | ||
fi | ||
${sed_cmd} "s/Created : .*$/Created : DATE/" "$f" | ||
${sed_cmd} "s/NMODL Compiler : .*$/NMODL Compiler : VERSION/" "$f" | ||
done | ||
} | ||
|
||
"${nmodl}" "${usecase_dir}"/*.mod --neuron -o "${output_dir}/neuron" | ||
sanitize "${output_dir}/neuron" | ||
|
||
"${nmodl}" "${usecase_dir}"/*.mod -o "${output_dir}"/coreneuron | ||
sanitize "${output_dir}/coreneuron" |
Submodule references
added at
86ea3b
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