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

Add tool "diff" for Linux and Unix #3501

Merged
merged 3 commits into from
Nov 11, 2024
Merged

Conversation

shekharsorot
Copy link
Contributor

Diff is used in Linux/Unix to compare two files, two directories or two streams.

In our case, Diff is used in XFStest since we need to compare *.full and *.out.full files for failed subtests to know what has went wrong.

TODO : Currently this tool is only for Linux and Unix, Windows alternative is FC which needs to be implemented.
Currently only "comparefiles" is implemented. as we come across requirements to compare directories and streams, we will add support for them.

        Args:
            src (PurePath): The source file or directory.
            dest (PurePath): The destination file or directory.
            cwd (Optional[PurePath]): The current working directory for the command.
            Defaults to None.
            sudo (bool): Whether to run the command with sudo. Defaults to False.
            timeout (int): The timeout for the command in seconds. Defaults to 600.
        Returns:
            str: The output of the diff command.

        Raises:
            AssertionError: If the exit code of the diff command is not 0 or 1.

0 means no changes, 1 means changes detected. 2 means general failure.

Edit: Due to a checksum issue, Github was treating init.py as new file. This has been fixed with a new commit and a new PR is being raised.

@squirrelsc
Copy link
Member

@LiliDeng LGTM

@LiliDeng LiliDeng merged commit 681f5bd into microsoft:main Nov 11, 2024
22 checks passed
LiliDeng pushed a commit that referenced this pull request Nov 13, 2024
* Update __init__.py

* Add files via upload

* Update diff.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants