Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libcperciva import #377

Merged
merged 4 commits into from
Oct 21, 2023
Merged

Libcperciva import #377

merged 4 commits into from
Oct 21, 2023

Conversation

gperciva
Copy link
Member

No description provided.

A later commit will switch to using "local" variables (indicated by
prepending the variable name with the function name), but those would be
extremely long with the previous function names.  Shortening them will
result in variables which are merely very long.

Changes to the overall API:
    s/setup_check_variables/setup_check/g

Changes to the valgrind API:
    s/valgrind_setup_cmd/valgrind_setup/g
    s/valgrind_check_basenames/valgrind_check/g
Changes to shared_test_functions.sh:
    s/_prepare_directory/_prepdir/g
    s/_notify_success_or_fail/_check/g

Changes to shared_valgrind_functions.sh:
    s/_valgrind_prep_directory/_val_prepdir/g
    s/_valgrind_check_optional/_val_checkver/g
    s/_valgrind_process_suppression_file/_val_generalize/g
    s/_valgrind_ensure_suppression/_val_ensure/g
    s/_valgrind_get_basename/_val_getbase/g
    s/_valgrind_check_logfile/_val_checkl/g
- ${valgrind_exit_code}: move to shared_test_functions.sh, since it's
  only used in that file.

- _val_checkver(): bail early if we're not using valgrind; that lets us
  eliminate one tab level in the rest of the function.

- _val_seg(): add new function, moving code out of _val_generalize().
POSIX sh does not include local variables [1], so we're switching to the
convention of using:
    _func_var_name
for local function variable names, so that we always have distinct names.

This does lead to rather verbose variable names, but this is an
acceptable trade-off in order to have correct program behaviour.

[1] Adding "local" to POSIX was discussed, but rejected, in:
    https://www.austingroupbugs.net/view.php?id=767
    It's possible to get "local variables" by abusing eval, but those
    solutions don't look appealing.
@cperciva cperciva merged commit f4d4f2c into master Oct 21, 2023
2 checks passed
@gperciva gperciva deleted the libcperciva-import branch October 21, 2023 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants