Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/test/ClangScanDeps/modules-include-tree-prefix-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

// RUN: clang-cas-test -cas %t/cas -print-include-tree @%t/System.casid | grep '<module-includes>' | sed 's|.* llvmcas|llvmcas|' > %t/system-module-includes.casid
// RUN: echo "System module-includes" >> %t/result.txt
// RUN: llvm-cas -cas %t/cas -cat-blob @%t/system-module-includes.casid >> %t/result.txt
// RUN: llvm-cas -cas %t/cas -cat-node-data @%t/system-module-includes.casid >> %t/result.txt

// RUN: FileCheck %s -input-file %t/result.txt -DPREFIX=%/t -check-prefix=NO_PATHS
// NO_PATHS-NOT: [[PREFIX]]
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-cas/ingest.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CHECK: syml
CHECK-SAME: sym_dir -> directory

RUN: llvm-cas --cas %t/cas --get-cas-id --data %S/Inputs/directory/file @%t/cas.id > %t/file.casid
RUN: llvm-cas --cas %t/cas --cat-blob @%t/file.casid | FileCheck %s --check-prefix=CHECK-TEST-FILE
RUN: llvm-cas --cas %t/cas --cat-node-data @%t/file.casid | FileCheck %s --check-prefix=CHECK-TEST-FILE

CHECK-TEST-FILE: test

Expand Down
17 changes: 6 additions & 11 deletions llvm/test/tools/llvm-cas/make-blob.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,24 @@ 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-blob @%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 --print-kind @%t/empty.casid |\
RUN: FileCheck %s -check-prefix CHECK-KIND
CHECK-EMPTY-NOT: {{.}}
CHECK-KIND: object

RUN: llvm-cas --cas %t.cas --cat-blob @%t/abc.casid |\
RUN: llvm-cas --cas %t.cas --cat-node-data @%t/abc.casid |\
RUN: FileCheck %s -check-prefix CHECK-ABC
RUN: llvm-cas --cas %t.cas --print-kind @%t/abc.casid |\
RUN: FileCheck %s -check-prefix CHECK-KIND
CHECK-ABC: abc

RUN: llvm-cas --cas %t.cas --cat-blob @%t/oneline-nonewline.casid |\
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-blob @%t/oneline.casid |\
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-blob @%t/oneline-nonewline.casid \
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-blob @%t/oneline.casid \
RUN: llvm-cas --cas %t.cas --cat-node-data @%t/oneline.casid \
RUN: >%t/oneline
RUN: diff %S/Inputs/oneline %t/oneline
8 changes: 0 additions & 8 deletions llvm/test/tools/llvm-cas/make-node.test
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ RUN: llvm-cas --cas %t/cas --ls-node-refs @%t/empty.casid |\
RUN: FileCheck %s -check-prefix CHECK-EMPTY -allow-empty
CHECK-EMPTY-NOT: {{.}}

RUN: llvm-cas --cas %t/cas --print-kind @%t/empty.casid |\
RUN: FileCheck %s -check-prefix CHECK-NO-KIND
### FIXME: Node ObjectKind with no reference is Blob kind in BuiltinCAS.
CHECK-NO-KIND: object

# 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.
Expand All @@ -27,13 +22,10 @@ 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 --print-kind \
RUN: @%t/complex.casid | FileCheck %s -check-prefix COMPLEX-KIND
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-KIND: object
COMPLEX-DATA: content

RUN: not llvm-cas --cas %t/cas --ls-tree @%t/complex.casid 2>&1 | FileCheck %s --check-prefix=CHECK-WRONG-TYPE
Expand Down
9 changes: 9 additions & 0 deletions llvm/tools/llvm-cas/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
set(LLVM_TARGET_DEFINITIONS Options.td)
tablegen(LLVM Options.inc -gen-opt-parser-defs)
add_public_tablegen_target(LLVMCASToolTableGen)

set(LLVM_LINK_COMPONENTS
Support
CAS
Option
RemoteCachingService
CASUtil
)

add_llvm_tool(llvm-cas
llvm-cas.cpp

DEPENDS
${tablegen_deps}
LLVMCASToolTableGen
)
95 changes: 95 additions & 0 deletions llvm/tools/llvm-cas/Options.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
include "llvm/Option/OptParser.td"

class F<string name> : Flag<["--", "-"], name>;

def grp_action : OptionGroup<"Actions">, HelpText<"llvm-cas actions">;

def help : F<"help">, HelpText<"Prints this help output">;
def : Flag<["-"], "h">, Alias<help>, HelpText<"Alias for --help">;

// Tool actions

def cas_dump : F<"dump">, HelpText<"Dump internal contents">, Group<grp_action>;
def cat_node_data : F<"cat-node-data">,
HelpText<"Cat node data">,
Group<grp_action>;
def diff_graph : F<"diff-graphs">, HelpText<"diff graphs">, Group<grp_action>;
def traverse_graph : F<"traverse-graph">,
HelpText<"traverse graph">,
Group<grp_action>;
def make_blob : F<"make-blob">, HelpText<"Make blob">, Group<grp_action>;
def make_node : F<"make-node">, HelpText<"Make node">, Group<grp_action>;
def ls_node_refs : F<"ls-node-refs">,
HelpText<"List node refs">,
Group<grp_action>;
def ls_tree : F<"ls-tree">, HelpText<"list tree">, Group<grp_action>;
def ls_tree_recursive : F<"ls-tree-recursive">,
HelpText<"list tree recursive">,
Group<grp_action>;
def ingest : F<"ingest">, HelpText<"ingest file system">, Group<grp_action>;
def merge_tree : F<"merge">, HelpText<"merge paths/cas-ids">, Group<grp_action>;
def get_cas_id : F<"get-cas-id">,
HelpText<"get cas id for file">,
Group<grp_action>;
def import : F<"import">,
HelpText<"Import objects from another CAS">,
Group<grp_action>;
def put_cache_key : F<"put-cache-key">,
HelpText<"Set a value for a cache key">,
Group<grp_action>;
def get_cache_result : F<"get-cache-result">,
HelpText<"Get the result value from a cache key">,
Group<grp_action>;
def validate : F<"validate">,
HelpText<"Validate ObjectStore">,
Group<grp_action>;
def validate_object : F<"validate-object">,
HelpText<"Validate the object for CASID">,
Group<grp_action>;
def validate_if_needed : F<"validate-if-needed">,
HelpText<"Validate cas contents if needed">,
Group<grp_action>;
def prune : F<"prune">, HelpText<"Prune local cas storage">, Group<grp_action>;

// Tool options

def cas_path : Separate<["-", "--"], "cas">,
MetaVarName<"<path>">,
HelpText<"Path to CAS on disk">;

def cas_plugin_path : Separate<["-", "--"], "fcas-plugin-path">,
MetaVarName<"<path>">,
HelpText<"Path to plugin CAS library">;

def cas_plugin_option : Separate<["-", "--"], "fcas-plugin-option">,
MetaVarName<"<option>">,
HelpText<"Plugin CAS Options">;

def upstream_cas : Separate<["-", "--"], "upstream-cas">,
MetaVarName<"<path>">,
HelpText<"Path to another upstream CAS">;

def data : Separate<["-", "--"], "data">,
MetaVarName<"<path>">,
HelpText<"Path to data or '-' for stdin">;

def check_hash : F<"check-hash">,
HelpText<"Check all hashes during validation">;

def allow_recovery : F<"allow-recovery">,
HelpText<"Allow recovery of CAS data">;

def force : F<"force">, HelpText<"Force validation even if unnecessary">;

def in_process : F<"in-process">, HelpText<"Validation in-process">;

def all_trees
: F<"all-trees">,
HelpText<"Print all trees, not just empty ones, for ls-tree-recursive">;

def prefix_map : Separate<["-", "--"], "prefix-map">,
MetaVarName<"BEFORE=AFTER">,
HelpText<"Prefix map for file system ingestion">;

def casid_file : F<"casid-file">,
HelpText<"Input is CASID file, just ingest CASID">;
Loading