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

Change zstdless behavior to align with zless #2909

Merged
merged 5 commits into from
Jan 22, 2022
Merged

Conversation

binhdvo
Copy link
Contributor

@binhdvo binhdvo commented Dec 6, 2021

Flags for zstdless will now be passed to less instead of zstd.

Not for immediate merge; this will change the behavior for zstdless and would be better to bake in dev for awhile rather than going into the impending release.

programs/zstdless Outdated Show resolved Hide resolved
Copy link
Contributor

@felixhandte felixhandte left a comment

Choose a reason for hiding this comment

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

This definitely looks like the right approach! I have one nit.

Maybe this is outside the scope of this PR, but it makes me uncomfortable that we have no tests for zstdless. I see we have at least a couple for zstdgrep and zstdcat in playTest.sh. Maybe we could add a couple for zstdless?

programs/zstdless Outdated Show resolved Hide resolved
@felixhandte felixhandte self-assigned this Jan 11, 2022
@felixhandte
Copy link
Contributor

Ok, looks good in terms of applying the requested changes. Did we decide adding tests is outside the scope of this PR? It would be nice to at least have a trivial few.

@Cyan4973
Copy link
Contributor

We don't need complex tests, but basic ones would be welcome.

That being said, I don't think they should be part of playTests.sh, because it would make this test script now dependent on zstdless, and there are situations where it's not desirable.

Probably making a new small tests/Makefile entry for this purpose would be appropriate, something like test-zstdless for example. Whatever is simpler.

@terrelln
Copy link
Contributor

That being said, I don't think they should be part of playTests.sh, because it would make this test script now dependent on zstdless, and there are situations where it's not desirable.

@Cyan4973 What scenarios are you thinking of? We do already use zstdgrep in this script.

@Cyan4973
Copy link
Contributor

That being said, I don't think they should be part of playTests.sh, because it would make this test script now dependent on zstdless, and there are situations where it's not desirable.

@Cyan4973 What scenarios are you thinking of? We do already use zstdgrep in this script.

playTests.sh is mostly associated to make check,
which is the "minimal set of fast tests for zstd CLI".
I can imagine make check being run on systems which only feature zstd, but no other derivative tools such as zstdless and zstdgrep.

Therefore, the comment I made regarding zstdless tests is also applicable for zstdgrep tests .

I presume these tests are currently present in playTests.sh because there was no other established solution nor requirements at the time.

Refactoring tests for zstdless and zstdgrep could be considered a separate task, in order to not mix topics.

@binhdvo
Copy link
Contributor Author

binhdvo commented Jan 20, 2022

Added some very basic tests, I will expand on these and move both zstdgrep and zstdless tests in a followup.

tests/playTests.sh Outdated Show resolved Hide resolved
programs/zstdless Outdated Show resolved Hide resolved
@binhdvo
Copy link
Contributor Author

binhdvo commented Jan 21, 2022

Updated and also added environment variable to specify zstd path, necessary for some of the testing platforms

Copy link
Contributor

@felixhandte felixhandte left a comment

Choose a reason for hiding this comment

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

Cool. A couple nits. I guess you'd said you were planning to follow up with more thorough tests? The major thing that seems to be missing is passing flags to zstdless and seeing that they go to less and not zstd.

tests/playTests.sh Outdated Show resolved Hide resolved
tests/playTests.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@felixhandte felixhandte left a comment

Choose a reason for hiding this comment

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

Oops, looks like Circle CI isn't happy:

/home/circleci/project/tests/../programs/zstdless: 8: exec: less: not found

I guess it's reasonable to wrap all the tests in an

if [ -n "$(which less)"]; then
    ...
fi

@binhdvo
Copy link
Contributor Author

binhdvo commented Jan 21, 2022

Test issues fixed

Copy link
Contributor

@felixhandte felixhandte left a comment

Choose a reason for hiding this comment

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

Ship it!

@binhdvo binhdvo merged commit 17017ac into facebook:dev Jan 22, 2022
yoniko added a commit to yoniko/zstd that referenced this pull request Jan 24, 2022
…ter_refactor

* origin/dev:
  AsyncIO compression part 1 - refactor of existing asyncio code (facebook#3021)
  cleanup double word in comment.
  slightly shortened status and summary lines in very verbose mode
  Change zstdless behavior to align with zless (facebook#2909)
  slightly shortened compression status update line
  More descriptive exclusion error; updated docs and copyright
  Typo (and missing commit)
  Suggestion from code review
  Python style change
  Fixed bugs found in other projects
  Updated README
  Test and tidy
  Feature parity with original shell script; needs further testing
  Work-in-progress; annotated types, added docs, parsed and resolved excluded files
  Using faster Python script to amalgamate
@Cyan4973 Cyan4973 mentioned this pull request Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants