-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[CAS] Add llvm-cas tools to inspect on-disk LLVMCAS #114104
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| content |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| content | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| RUN: rm -rf %t %t.cas | ||
| RUN: mkdir %t | ||
|
|
||
| RUN: llvm-cas --cas %t.cas --make-blob \ | ||
| RUN: --data %S/Inputs/oneline >%t/oneline.casid | ||
| RUN: llvm-cas --cas %t.cas --make-blob \ | ||
| RUN: --data %S/Inputs/oneline-nonewline >%t/oneline-nonewline.casid | ||
|
|
||
| RUN: llvm-cas --cas %t.cas --put-cache-key @%t/oneline.casid @%t/oneline-nonewline.casid | ||
| RUN: llvm-cas --cas %t.cas --get-cache-result @%t/oneline.casid > %t/result.casid | ||
| RUN: diff %t/oneline-nonewline.casid %t/result.casid | ||
|
|
||
| RUN: not llvm-cas --cas %t.cas --get-cache-result @%t/oneline-nonewline.casid 2>&1 | FileCheck %s | ||
| CHECK: result not found |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| RUN: rm -rf %t %t.cas | ||
| RUN: mkdir %t | ||
|
|
||
| RUN: llvm-cas --cas %t.cas --make-blob \ | ||
| RUN: --data /dev/null > %t/empty.casid | ||
| RUN: echo "abc" | \ | ||
| RUN: llvm-cas --cas %t.cas --make-blob \ | ||
| RUN: --data - >%t/abc.casid | ||
|
|
||
| RUN: llvm-cas --cas %t/cas --put-cache-key @%t/abc.casid @%t/empty.casid | ||
| RUN: llvm-cas --cas %t/cas --get-cache-result @%t/abc.casid > %t/empty2.casid | ||
| RUN: diff %t/empty.casid %t/empty2.casid | ||
|
|
||
| RUN: not llvm-cas --cas %t/cas --get-cache-result @%t/empty.casid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| RUN: rm -rf %t | ||
| RUN: mkdir %t | ||
|
|
||
| RUN: llvm-cas --cas %t/cas --make-blob \ | ||
| RUN: --data - </dev/null | ||
|
|
||
| RUN: llvm-cas --cas %t/cas --make-blob \ | ||
| RUN: --data %s | ||
|
|
||
| RUN: llvm-cas --cas %t/cas --dump | FileCheck %s | ||
|
|
||
| // check the dump format. | ||
| CHECK: index: | ||
| CHECK-NEXT: hash-num-bits= | ||
| CHECK-NEXT: root addr= | ||
| // it should has at least one index | ||
| CHECK-NEXT: - index= | ||
|
|
||
| // two records | ||
| CHECK: record | ||
| CHECK-NEXT: - addr= | ||
| CHECK-NEXT: - addr= | ||
|
|
||
| // both should be small enough to be in data pool | ||
| CHECK: pool: | ||
| CHECK-NEXT: - addr= | ||
| CHECK-NEXT: - addr= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| if not config.have_ondisk_cas: | ||
| config.unsupported = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| RUN: rm -rf %t %t.cas | ||
| RUN: mkdir %t | ||
|
|
||
| RUN: llvm-cas --cas %t.cas --make-blob \ | ||
| RUN: --data - </dev/null >%t/empty.casid | ||
| RUN: sed -e 's,^.,CHECK: ,' <%t/empty.casid >%t/empty.check | ||
| RUN: llvm-cas --cas %t.cas --make-blob \ | ||
| RUN: --data /dev/null | FileCheck %t/empty.check | ||
| RUN: echo "abc" | \ | ||
| RUN: llvm-cas --cas %t.cas --make-blob \ | ||
| RUN: --data - >%t/abc.casid | ||
| RUN: llvm-cas --cas %t.cas --make-blob \ | ||
| RUN: --data %S/Inputs/oneline >%t/oneline.casid | ||
| RUN: llvm-cas --cas %t.cas --make-blob \ | ||
| RUN: --data %S/Inputs/oneline-nonewline >%t/oneline-nonewline.casid | ||
|
|
||
| RUN: llvm-cas --cas %t.cas --cat-node-data @%t/empty.casid |\ | ||
| RUN: FileCheck %s -check-prefix CHECK-EMPTY -allow-empty | ||
| CHECK-EMPTY-NOT: {{.}} | ||
|
|
||
| RUN: llvm-cas --cas %t.cas --cat-node-data @%t/abc.casid |\ | ||
| RUN: FileCheck %s -check-prefix CHECK-ABC | ||
| CHECK-ABC: abc | ||
|
|
||
| RUN: llvm-cas --cas %t.cas --cat-node-data @%t/oneline-nonewline.casid |\ | ||
| RUN: FileCheck %s -check-prefix CHECK-ONELINE | ||
| RUN: llvm-cas --cas %t.cas --cat-node-data @%t/oneline.casid |\ | ||
| RUN: FileCheck %s -check-prefix CHECK-ONELINE | ||
| CHECK-ONELINE: content | ||
|
|
||
| # Double-check newlines. | ||
| RUN: llvm-cas --cas %t.cas --cat-node-data @%t/oneline-nonewline.casid \ | ||
| RUN: >%t/oneline-nonewline | ||
| RUN: diff %S/Inputs/oneline-nonewline %t/oneline-nonewline | ||
| RUN: llvm-cas --cas %t.cas --cat-node-data @%t/oneline.casid \ | ||
| RUN: >%t/oneline | ||
| RUN: diff %S/Inputs/oneline %t/oneline | ||
|
|
||
| # Validate | ||
| RUN: llvm-cas --cas %t.cas --validate-object @%t/oneline-nonewline.casid | ||
| RUN: llvm-cas --cas %t.cas --validate-object @%t/oneline.casid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| RUN: rm -rf %t | ||
| RUN: mkdir %t | ||
|
|
||
| # Make some empty objects. | ||
| RUN: llvm-cas --cas %t/cas --make-node \ | ||
| RUN: --data - </dev/null >%t/empty.casid | ||
|
|
||
| RUN: llvm-cas --cas %t/cas --cat-node-data @%t/empty.casid |\ | ||
| RUN: FileCheck %s -check-prefix CHECK-EMPTY -allow-empty | ||
| RUN: llvm-cas --cas %t/cas --ls-node-refs @%t/empty.casid |\ | ||
| RUN: FileCheck %s -check-prefix CHECK-EMPTY -allow-empty | ||
| CHECK-EMPTY-NOT: {{.}} | ||
|
|
||
| # Make a complex object, which references existing ones. Reference a blob and | ||
| # other objects, and reference one of them twice to be sure they don't get | ||
| # deduped. | ||
| RUN: llvm-cas --cas %t/cas --make-blob --data /dev/null \ | ||
| RUN: >%t/empty-blob.casid | ||
| RUN: cat %t/empty.casid %t/empty.casid %t/empty-blob.casid \ | ||
| RUN: >%t/complex.refs | ||
| RUN: cat %t/complex.refs | sed -e 's,^.,CHECK: ,' > %t/complex.check | ||
| RUN: llvm-cas --cas %t/cas --make-node \ | ||
| RUN: --data %S/Inputs/oneline @%t/complex.refs \ | ||
| RUN: >%t/complex.casid | ||
| RUN: llvm-cas --cas %t/cas --cat-node-data \ | ||
| RUN: @%t/complex.casid | FileCheck %s -check-prefix COMPLEX-DATA | ||
| RUN: llvm-cas --cas %t/cas --ls-node-refs @%t/complex.casid |\ | ||
| RUN: FileCheck %t/complex.check | ||
| COMPLEX-DATA: content | ||
|
|
||
| RUN: llvm-cas --cas %t/cas --validate-object @%t/complex.casid | ||
|
|
||
| # Import from a new CAS. | ||
| RUN: llvm-cas --cas %t/new-cas --upstream-cas %t/cas --import @%t/complex.casid | ||
| RUN: llvm-cas --cas %t/new-cas --cat-node-data \ | ||
| RUN: @%t/complex.casid | FileCheck %s -check-prefix COMPLEX-DATA | ||
| RUN: llvm-cas --cas %t/new-cas --validate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| RUN: rm -rf %t | ||
| RUN: mkdir %t | ||
|
|
||
| RUN: llvm-cas --cas %t/cas --make-blob --data %S/Inputs/oneline > %t/id | ||
|
|
||
| # Confirm that the ID has the right prefix, is well-formed, and that there's | ||
| # nothing else on the line. | ||
| RUN: FileCheck %s --match-full-lines --strict-whitespace <%t/id | ||
| CHECK:llvmcas://{{[a-z0-9]+}} | ||
|
|
||
| # Confirm that there's a newline after. | ||
| RUN: wc -l <%t/id | FileCheck %s -check-prefix=NEWLINE | ||
| NEWLINE: 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| RUN: rm -rf %t | ||
| RUN: mkdir %t | ||
|
|
||
| # Ingest a blob which just fits inside the CAS data pool to make sure the validate passes. | ||
| RUN: truncate -s 7 %t/file | ||
| RUN: cat %t/file | \ | ||
| RUN: llvm-cas --cas %t/cas --make-blob \ | ||
| RUN: --data - | ||
| RUN: llvm-cas --cas %t/cas --validate --check-hash | ||
|
|
||
| RUN: llvm-cas --cas %t/cas --validate | ||
| RUN: llvm-cas --cas %t/cas --validate --check-hash | ||
|
|
||
| RUN: rm %t/cas/v1.1/data.v1 | ||
| RUN: not llvm-cas --cas %t/cas --validate | ||
| RUN: not llvm-cas --cas %t/cas --validate --check-hash | ||
|
|
||
| RUN: mkdir %t/ac | ||
|
|
||
| RUN: llvm-cas --cas %t/ac --make-blob \ | ||
| RUN: --data /dev/null > %t/empty.casid | ||
| RUN: echo "abc" | \ | ||
| RUN: llvm-cas --cas %t/ac --make-blob \ | ||
| RUN: --data - >%t/abc.casid | ||
|
|
||
| RUN: llvm-cas --cas %t/ac --put-cache-key @%t/abc.casid @%t/empty.casid | ||
| RUN: llvm-cas --cas %t/ac --validate | ||
| # Note: records are 40 bytes (32 hash bytes + 8 byte value), so trim the last | ||
| # allocated record, leaving it invalid. | ||
| RUN: truncate -s -40 %t/ac/v1.1/actions.v1 | ||
| RUN: not llvm-cas --cas %t/ac --validate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| set(LLVM_LINK_COMPONENTS | ||
| Support | ||
| CAS | ||
| ) | ||
|
|
||
| add_llvm_tool(llvm-cas | ||
| llvm-cas.cpp | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.