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 and trivial fixes #376

Merged
merged 6 commits into from
Oct 12, 2023
Merged

Libcperciva import and trivial fixes #376

merged 6 commits into from
Oct 12, 2023

Conversation

gperciva
Copy link
Member

@gperciva gperciva commented Oct 2, 2023

No description provided.

- Add find_system() to the "public API", which should have been part of:
    2023-06-29 scripts: misc fixes
    ed4c19ad5a55963e69792209a1eafc12f14c068d
  find_system() is not used by any other scripts in libcperciva, but
  other projects make use of it.

- Fix the API comment for run_scenarios(), which should have been part of:
    2021-03-24 tests: add `make test N=` to shared framework
    acea39b8aeaeb88a8fa86edb1e8e7c59c200585f

- Fix the API comment for valgrind_check_optional(), which was incorrect
  from the very beginning:
    2017-10-28 tests: import shared_test_functions.sh
    d486415352a2c95a98cc4935fd4ca6861ff8ed9c

- Use {} for $USE_VALGRIND and $PATH in comments.  This should have been
  part of:
    2023-08-06 scripts: always use double quotes and curly braces
    a1e8ac785558b317de84d3821be27fa525d359ef
- document the public variables
- define them in a single place
- instead of recording the number of open file descriptors (as a public
  variable), just keep the relevant filename; we can extract the actual
  number every time we need it.  This simplifies the logic of
  USE_VALGRIND_NO_REGEN.
In POSIX sh, there's no such thing as "public" or "private" functions.

However, functions are allowed to contain underscores [1], so we're
adopting the convention of leading underscores indicating a function
which is not intended to be called by code in a different file.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_235

Private functions in shared_test_functions.sh:
    prepare_directory
    notify_success_or_fail
    scenario_runner

Private functions in shared_valgrind_functions.sh:
    valgrind_prepare_directory
    valgrind_check_optional
    valgrind_process_suppression_file
    valgrind_ensure_suppression
    valgrind_get_basename
    valgrind_check_logfile
- Fix single space after period
- Add "Success!" where appropriate
@gperciva gperciva changed the title Libcperciva import Libcperciva import and trivial fixes Oct 2, 2023
@gperciva
Copy link
Member Author

gperciva commented Oct 2, 2023

Includes function pointer style fixes to lib-platform/crypto/crypto_scrypt.c, and a "Success!" comment in lib/scryptenc/scryptenc_cpuperf.c.

@gperciva gperciva force-pushed the libcperciva-import branch from 38ef7fc to 97ff1c8 Compare October 2, 2023 02:53
- use trace-children=yes.  (This actually means "trace exec"; the
  valgrind man page even admits that the option is badly named!)

- allow our tests to only check the parent pid

In more detail, in our tests/??-*.sh, we would set up:

    scenario_cmd() {
        ...
        c_valgrind_cmd=$(valgrind_setup_cmd "valgrind-parent")
        ${c_valgrind_cmd} ./test_something_with_forks

If we have two pids from a single binary, then our valgrind test will
assume that we're using daemonize() and ignore any leaks from the parent
pid.  (This is exactly what we want for daemonize().)

However, if we use fork() but keep the parent, then we want the
opposite: we should check for leaks in the parent, and ignore leaks from
the children.

We need to explicitly add something to the log filename beacuse if we
didn't, then a valgrind check with two pids wouldn't know whether to
complain about leaks in the parent or child.
- fix missing space between return type and opening parenthesis
- fix missing space after * or **
@gperciva gperciva force-pushed the libcperciva-import branch from 97ff1c8 to 442cf00 Compare October 2, 2023 02:54
@cperciva cperciva merged commit fbd5b10 into master Oct 12, 2023
2 checks passed
@gperciva gperciva deleted the libcperciva-import branch October 12, 2023 02:42
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