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

common: unify testconfig generation scripts #5803

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

janekmi
Copy link
Contributor

@janekmi janekmi commented Jul 17, 2023

This change is Reviewable

@janekmi janekmi added the sprint goal This pull request is part of the ongoing sprint label Jul 17, 2023
@janekmi janekmi added this to the 2.0.0 milestone Jul 17, 2023
Copy link
Contributor

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: 0 of 8 files reviewed, 5 unresolved discussions (waiting on @janekmi)

a discussion (no related file):
I propose to use these as default values if not provided in the environment:

          OUTPUT_DIR: src/test
          PMEM_FS_DIR: /mnt/pmem0
          PMEM_FS_DIR_FORCE_PMEM: 0
          force_cacheline: 'True'
          force_byte: 'False'

With such a solution, the script can be easily used on the development machine to reproduce the CI environment.



utils/create-testconfig.sh line 28 at r1 (raw file):

    echo "OUTPUT_DIR is empty";
    exit 1;
fi

Let's assume some default values to simplify CI env reproduction.

Suggestion:

if [ -z "$OUTPUT_DIR" ]; then
    _OUTPUT_DIR=src/test
else
    _OUTPUT_DIR=$OUTPUT_DIR
fi

utils/create-testconfig.sh line 76 at r1 (raw file):

# generate Bash's test configuration file
cat << EOL > $OUTPUT_DIR/testconfig.sh

.

Suggestion:

cat << EOL > $_OUTPUT_DIR/testconfig.sh

utils/create-testconfig.sh line 89 at r1 (raw file):

# generate Python's test configuration file
cat << EOL > $OUTPUT_DIR/testconfig.py 

Suggestion:

cat << EOL > $_OUTPUT_DIR/testconfig.py

utils/docker/configure-tests.sh line 16 at r1 (raw file):

LONGDIR=LoremipsumdolorsitametconsecteturadipiscingelitVivamuslacinianibhattortordictumsollicitudinNullamvariusvestibulumligulaetegestaselitsemperidMaurisultriciesligulaeuipsumtinciduntluctusMorbimaximusvariusdolorid
# this path is ~3000 characters long
DIRSUFFIX="$LONGDIR/$LONGDIR/$LONGDIR/$LONGDIR/$LONGDIR"

DIRSUFFIX is used in unittest.sh

Code quote:

DIRSUFFIX

Copy link
Contributor

@osalyk osalyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 8 of 8 files at r1, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @janekmi)

@janekmi janekmi force-pushed the testconfig-unified-generation branch from 463c8ea to e995fec Compare July 18, 2023 08:18
Copy link
Contributor Author

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 7 of 8 files at r1, 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @grom72)

a discussion (no related file):

Previously, grom72 (Tomasz Gromadzki) wrote…

I propose to use these as default values if not provided in the environment:

          OUTPUT_DIR: src/test
          PMEM_FS_DIR: /mnt/pmem0
          PMEM_FS_DIR_FORCE_PMEM: 0
          force_cacheline: 'True'
          force_byte: 'False'

With such a solution, the script can be easily used on the development machine to reproduce the CI environment.

Do you think that

          force_cacheline: 'True'
          force_byte: 'False'

is more universally applicable compared to:

          force_cacheline: 'False'
          force_byte: 'True'

Note: The first one applies naturally to machines providing PMem at byte granularity whereas the second one to machines providing cache line granularity. The rule of thumb is that what is provided doesn't have to be forced.



utils/create-testconfig.sh line 28 at r1 (raw file):

Previously, grom72 (Tomasz Gromadzki) wrote…

Let's assume some default values to simplify CI env reproduction.

Done.


utils/create-testconfig.sh line 76 at r1 (raw file):

Previously, grom72 (Tomasz Gromadzki) wrote…

.

Done.


utils/create-testconfig.sh line 89 at r1 (raw file):

# generate Python's test configuration file
cat << EOL > $OUTPUT_DIR/testconfig.py 

Done.


utils/docker/configure-tests.sh line 16 at r1 (raw file):

Previously, grom72 (Tomasz Gromadzki) wrote…

DIRSUFFIX is used in unittest.sh

I see no value to this.

  1. No user does such a thing.
  2. Throughout the PMDK existence I have heard of no issue found thanks to this.
  3. As far as I can tell it is very Windows-related: add long file path support  #2056

Please tell me if you still insist on having it back.

@codecov
Copy link

codecov bot commented Jul 18, 2023

Codecov Report

Merging #5803 (c6f6e34) into master (2588011) will increase coverage by 2.24%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #5803      +/-   ##
==========================================
+ Coverage   68.74%   70.98%   +2.24%     
==========================================
  Files         131      131              
  Lines       19677    19175     -502     
  Branches     3259     3193      -66     
==========================================
+ Hits        13527    13612      +85     
+ Misses       6150     5563     -587     

@janekmi janekmi force-pushed the testconfig-unified-generation branch 2 times, most recently from 3982af2 to 548e9fc Compare July 18, 2023 10:08
Copy link
Contributor

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 8 files at r1, 3 of 4 files at r2.
Reviewable status: 7 of 8 files reviewed, 6 unresolved discussions (waiting on @janekmi)

a discussion (no related file):

Previously, janekmi (Jan Michalski) wrote…

Do you think that

          force_cacheline: 'True'
          force_byte: 'False'

is more universally applicable compared to:

          force_cacheline: 'False'
          force_byte: 'True'

Note: The first one applies naturally to machines providing PMem at byte granularity whereas the second one to machines providing cache line granularity. The rule of thumb is that what is provided doesn't have to be forced.

No, I mean I want to use this script without any env variable to be set.
Let's select the one that is more useful -> cache line granularity


a discussion (no related file):
We should add DIRSUFFIX as mentioned in testconfig.sh.example otherwise, we create a shadow area with undefined(uninitialized) variables.



utils/create-testconfig.sh line 43 at r4 (raw file):

TEST_BUILD="debug nondebug"
build="['debug', 'nondebug']"
TEST_TIMEOUT=120m

This timeout is valid for PMem tests, for GHA 3 minutes was used.
I think that we should use anv variable in case of GHA to decrease it to 3 minutes only

Suggestion:

TEST_TIMEOUT=${TEST_TIMEOUT:-120m}

utils/docker/prepare-for-build.sh line 29 at r3 (raw file):

		force_cacheline=True \
		force_byte=True \
		../create-testconfig.sh

.

Suggestion:

	OUTPUT_DIR=$WORKDIR/src/test \
		PMEM_FS_DIR=/dev/shm \
		PMEM_FS_DIR_FORCE_PMEM=1 \
		force_cacheline=True \
		force_byte=True \
		TEST_TIMEOUT=3m \
		../create-testconfig.sh

utils/gha-runners/create-testconfig.sh line 31 at r4 (raw file):

cat >${CONF_PATH}/testconfig.py <<EOL
config = {
    'unittest_log_level': 1,

Why is it removed from the new file?

Code quote:

unittest_log_level

Copy link
Contributor

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 7 of 8 files reviewed, 6 unresolved discussions (waiting on @janekmi)


utils/docker/configure-tests.sh line 16 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

I see no value to this.

  1. No user does such a thing.
  2. Throughout the PMDK existence I have heard of no issue found thanks to this.
  3. As far as I can tell it is very Windows-related: add long file path support  #2056

Please tell me if you still insist on having it back.

DIRSUFIX is used in the unittest.sh and shall be defined in testconfig.sh

Copy link
Contributor

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm - something has been missing.

Reviewable status: 7 of 8 files reviewed, 6 unresolved discussions (waiting on @janekmi)

Copy link
Contributor

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/pmem/pmdk/actions/runs/5586095077/jobs/10209997262

Reviewable status: 7 of 8 files reviewed, 6 unresolved discussions (waiting on @janekmi)

@janekmi janekmi force-pushed the testconfig-unified-generation branch 2 times, most recently from d878920 to fc4b731 Compare July 18, 2023 13:08
Copy link
Contributor Author

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r4, 1 of 1 files at r6.
Reviewable status: 7 of 8 files reviewed, 6 unresolved discussions (waiting on @grom72 and @osalyk)

a discussion (no related file):

Previously, grom72 (Tomasz Gromadzki) wrote…

No, I mean I want to use this script without any env variable to be set.
Let's select the one that is more useful -> cache line granularity

Done.


a discussion (no related file):

Previously, grom72 (Tomasz Gromadzki) wrote…

We should add DIRSUFFIX as mentioned in testconfig.sh.example otherwise, we create a shadow area with undefined(uninitialized) variables.

There are no uninitialized variables in Bash. If it is not defined it is empty. DIRSUFFIX is completely optional. This fact is mentioned in testconfig.sh.example as well as obvious from the quick test framework browsing.

The bottom line is: I refuse to fulfil your wish. Please provide stronger arguments if you wish so. 😉



utils/create-testconfig.sh line 43 at r4 (raw file):

Previously, grom72 (Tomasz Gromadzki) wrote…

This timeout is valid for PMem tests, for GHA 3 minutes was used.
I think that we should use anv variable in case of GHA to decrease it to 3 minutes only

Yeah. It was. At least for Python tests. 🤦‍♂️
Done.


utils/docker/configure-tests.sh line 16 at r1 (raw file):

Previously, grom72 (Tomasz Gromadzki) wrote…

DIRSUFIX is used in the unittest.sh and shall be defined in testconfig.sh

As I said above. Yes, it is. But it is optional. I see no value to little value in using it.


utils/docker/prepare-for-build.sh line 29 at r3 (raw file):

Previously, grom72 (Tomasz Gromadzki) wrote…

.

Done.


utils/gha-runners/create-testconfig.sh line 31 at r4 (raw file):

Previously, grom72 (Tomasz Gromadzki) wrote…

Why is it removed from the new file?

Done.

Copy link
Contributor Author

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 2 files at r5.
Reviewable status: all files reviewed (commit messages unreviewed), 6 unresolved discussions (waiting on @grom72)

Copy link
Contributor

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 8 files at r1, 1 of 2 files at r5, 1 of 1 files at r6, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @janekmi)

a discussion (no related file):

Previously, janekmi (Jan Michalski) wrote…

There are no uninitialized variables in Bash. If it is not defined it is empty. DIRSUFFIX is completely optional. This fact is mentioned in testconfig.sh.example as well as obvious from the quick test framework browsing.

The bottom line is: I refuse to fulfil your wish. Please provide stronger arguments if you wish so. 😉

Let's remove it.


Copy link
Contributor

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @janekmi)

@janekmi janekmi force-pushed the testconfig-unified-generation branch from fc4b731 to 9f7f0d5 Compare July 18, 2023 14:17
Copy link
Contributor Author

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r7, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @janekmi)

Copy link
Contributor

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r7, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @janekmi)

@janekmi janekmi force-pushed the testconfig-unified-generation branch from 9f7f0d5 to c6f6e34 Compare July 18, 2023 21:13
@janekmi janekmi added the build system What Makefiles do label Jul 18, 2023
Signed-off-by: Jan Michalski <jan.michalski@intel.com>
Copy link
Contributor

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r8, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @janekmi)

Copy link
Contributor

@osalyk osalyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 3 of 4 files at r2, 1 of 2 files at r5, 1 of 1 files at r8, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @janekmi)

@janekmi janekmi merged commit d4f2ff9 into pmem:master Jul 19, 2023
@janekmi janekmi removed the build system What Makefiles do label Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sprint goal This pull request is part of the ongoing sprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants