diff --git a/garnet/bin/iquery/BUILD.gn b/garnet/bin/iquery/BUILD.gn index b411b1e89cc16bca60dec5aa0761e396cfc154f4..f615eadd38823b6d61326f7d2e3492fa0434d8f6 100644 --- a/garnet/bin/iquery/BUILD.gn +++ b/garnet/bin/iquery/BUILD.gn @@ -8,30 +8,23 @@ import("//build/testing/environments.gni") source_set("lib") { sources = [ - "formatter.h", - "formatters/json.cc", - "formatters/json.h", - "formatters/text.cc", - "formatters/text.h", "modes.cc", "modes.h", "options.cc", "options.h", - "utils.cc", - "utils.h", ] configs += [ "//third_party/cobalt:cobalt_config" ] deps = [ "//src/lib/fxl", - "//third_party/cobalt/util/crypto_util", - "//third_party/rapidjson", ] public_deps = [ "//garnet/public/lib/fostr", "//garnet/public/lib/inspect/query", + "//garnet/public/lib/inspect/query:json_formatter", + "//garnet/public/lib/inspect/query:text_formatter", ] } @@ -51,20 +44,6 @@ executable("bin") { ] } -executable("test") { - testonly = true - output_name = "iquery_test" - - sources = [ - "utils_test.cc", - ] - - deps = [ - ":lib", - "//third_party/googletest:gtest_main", - ] -} - package("iquery") { deps = [ ":bin", @@ -77,16 +56,3 @@ package("iquery") { }, ] } - -test_package("iquery_test") { - deps = [ - ":test", - ] - - tests = [ - { - name = "iquery_test" - environments = basic_envs - }, - ] -} diff --git a/garnet/bin/iquery/formatter.h b/garnet/bin/iquery/formatter.h deleted file mode 100644 index 1be0efed74faf9692f116ec264a1726f88daa007..0000000000000000000000000000000000000000 --- a/garnet/bin/iquery/formatter.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef GARNET_BIN_IQUERY_FORMATTER_H_ -#define GARNET_BIN_IQUERY_FORMATTER_H_ - -#include <lib/inspect/query/source.h> -#include <lib/inspect/reader.h> - -#include <string> -#include <vector> - -#include "garnet/bin/iquery/modes.h" -#include "garnet/bin/iquery/options.h" -#include "garnet/bin/iquery/utils.h" - -namespace iquery { - -class Formatter { - public: - virtual ~Formatter() = default; - virtual std::string Format(const Options&, - const std::vector<inspect::Source>&) = 0; -}; - -} // namespace iquery - -#endif // GARNET_BIN_IQUERY_FORMATTER_H_ diff --git a/garnet/bin/iquery/formatters/json.cc b/garnet/bin/iquery/formatters/json.cc deleted file mode 100644 index b317ebcf9a4462f30c325824da6de0aceded792f..0000000000000000000000000000000000000000 --- a/garnet/bin/iquery/formatters/json.cc +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "garnet/bin/iquery/formatters/json.h" - -#include <rapidjson/prettywriter.h> - -#include "garnet/bin/iquery/utils.h" -#include "lib/inspect/hierarchy.h" -#include "third_party/cobalt/util/crypto_util/base64.h" - -namespace iquery { - -namespace { - -using cobalt::crypto::Base64Encode; - -template <typename WriterType, typename ArrayType> -void FormatArray(WriterType& writer, const ArrayType& array) { - auto buckets = array.GetBuckets(); - if (buckets.size() != 0) { - writer->StartObject(); - writer->String("buckets"); - writer->StartArray(); - for (const auto& bucket : buckets) { - writer->StartObject(); - writer->String("floor"); - writer->String(FormatNumericValue(bucket.floor)); - writer->String("upper_bound"); - writer->String(FormatNumericValue(bucket.upper_limit)); - writer->String("count"); - writer->String(FormatNumericValue(bucket.count)); - writer->EndObject(); - } - writer->EndArray(); - writer->EndObject(); - } else { - writer->StartArray(); - for (const auto& val : array.value()) { - writer->String(FormatNumericValue(val)); - } - writer->EndArray(); - } -} - -template <typename WriterType> -void FormatMetricValue(WriterType& writer, - const inspect::hierarchy::Metric& metric) { - switch (metric.format()) { - case inspect::hierarchy::MetricFormat::INT_ARRAY: - FormatArray(writer, metric.Get<inspect::hierarchy::IntArray>()); - break; - case inspect::hierarchy::MetricFormat::UINT_ARRAY: - FormatArray(writer, metric.Get<inspect::hierarchy::UIntArray>()); - break; - case inspect::hierarchy::MetricFormat::DOUBLE_ARRAY: - FormatArray(writer, metric.Get<inspect::hierarchy::DoubleArray>()); - break; - default: - writer->String(FormatNumericMetricValue(metric)); - } -} - -// Create the appropriate Json exporter according to the given options. -// NOTE(donoso): For some reason, rapidjson decided that while Writer is a class -// PrettyWriter inherits from, it is *not* a virtual interface. -// This means I cannot pass a Writer pointer around and get each -// writer to do it's thing, which is what I expected. -// Eventually this class will have to become a dispatcher that -// passes the writer to a templatized version of FormatCat, Ls -// and Find. -template <typename OutputStream> -std::unique_ptr<rapidjson::PrettyWriter<OutputStream>> GetJsonWriter( - OutputStream& os, const Options&) { - // NOTE(donosoc): When json formatter options are given, create the - // appropriate json writer and configure it here. - return std::make_unique<rapidjson::PrettyWriter<OutputStream>>(os); -} - -// FormatFind ------------------------------------------------------------------ - -std::string FormatFind(const Options& options, - const std::vector<inspect::Source>& results) { - rapidjson::StringBuffer sb; - auto writer = GetJsonWriter(sb, options); - - writer->StartArray(); - for (const auto& entry_point : results) { - entry_point.VisitObjectsInHierarchy( - [&](const std::vector<std::string>& path, - const inspect::ObjectHierarchy& hierarchy) { - writer->String(FormatPath(options.path_format, - entry_point.GetLocation().NodePath(path), - hierarchy.node().name())); - }); - } - writer->EndArray(); - - return sb.GetString(); -} - -// FormatLs -------------------------------------------------------------------- - -std::string FormatLs(const Options& options, - const std::vector<inspect::Source>& results) { - rapidjson::StringBuffer sb; - auto writer = GetJsonWriter(sb, options); - - writer->StartArray(); - for (const auto& entry_point : results) { - const auto& hierarchy = entry_point.GetHierarchy(); - for (const auto& child : hierarchy.children()) { - writer->String( - FormatPath(options.path_format, - entry_point.GetLocation().NodePath({child.node().name()}), - child.node().name())); - } - } - writer->EndArray(); - - return sb.GetString(); -} - -// FormatCat ------------------------------------------------------------------- - -template <typename OutputStream> -void RecursiveFormatCat(rapidjson::PrettyWriter<OutputStream>* writer, - const Options& options, - const inspect::Source& entry_point, - const inspect::ObjectHierarchy& root) { - writer->StartObject(); - - // Properties. - for (const auto& property : root.node().properties()) { - writer->String(FormatStringBase64Fallback(property.name())); - switch (property.format()) { - case inspect::hierarchy::PropertyFormat::STRING: - writer->String(FormatStringBase64Fallback( - property.Get<inspect::hierarchy::StringProperty>().value())); - break; - case inspect::hierarchy::PropertyFormat::BYTES: { - auto& val = - property.Get<inspect::hierarchy::ByteVectorProperty>().value(); - writer->String(FormatStringBase64Fallback( - {reinterpret_cast<const char*>(val.data()), val.size()})); - break; - } - default: - FXL_LOG(WARNING) << "Failed to format unknown type for " - << property.name(); - writer->String("<Unknown type, format failed>"); - break; - } - } - - // Metrics. - for (const auto& metric : root.node().metrics()) { - writer->String(FormatStringBase64Fallback(metric.name())); - FormatMetricValue(writer, metric); - } - - for (const auto& child : root.children()) { - writer->String(child.node().name()); - RecursiveFormatCat(writer, options, entry_point, child); - } - - writer->EndObject(); -} - -std::string FormatCat(const Options& options, - const std::vector<inspect::Source>& results) { - rapidjson::StringBuffer sb; - auto writer = GetJsonWriter(sb, options); - - writer->StartArray(); - for (const auto& entry_point : results) { - writer->StartObject(); - writer->String("path"); - // The "path" field always ignored the object's name in JSON output. - writer->String(FormatPath(options.path_format, - entry_point.GetLocation().NodePath(), - entry_point.GetLocation().NodePath())); - writer->String("contents"); - writer->StartObject(); - writer->String(entry_point.GetHierarchy().node().name()); - RecursiveFormatCat(writer.get(), options, entry_point, - entry_point.GetHierarchy()); - writer->EndObject(); - writer->EndObject(); - } - writer->EndArray(); - - return sb.GetString(); -} - -} // namespace - -std::string JsonFormatter::Format(const Options& options, - const std::vector<inspect::Source>& results) { - switch (options.mode) { - case Options::Mode::CAT: - return FormatCat(options, results); - case Options::Mode::FIND: - return FormatFind(options, results); - case Options::Mode::LS: - return FormatLs(options, results); - case Options::Mode::UNSET: { - FXL_LOG(ERROR) << "Unset Mode"; - return ""; - } - } -} - -} // namespace iquery diff --git a/garnet/bin/iquery/formatters/json.h b/garnet/bin/iquery/formatters/json.h deleted file mode 100644 index 7d52b8bdd646ae9482d8b097b4656b9cbaf03aba..0000000000000000000000000000000000000000 --- a/garnet/bin/iquery/formatters/json.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef GARNET_BIN_IQUERY_FORMATTERS_JSON_H_ -#define GARNET_BIN_IQUERY_FORMATTERS_JSON_H_ - -#include <lib/inspect/query/source.h> - -#include "garnet/bin/iquery/formatter.h" - -namespace iquery { - -class JsonFormatter : public Formatter { - public: - std::string Format(const Options&, - const std::vector<inspect::Source>&) override; -}; - -} // namespace iquery - -#endif // GARNET_BIN_IQUERY_FORMATTERS_JSON_H_ diff --git a/garnet/bin/iquery/formatters/text.cc b/garnet/bin/iquery/formatters/text.cc deleted file mode 100644 index 4971c8915515f793edc9a947cb3e60f2ce71eb80..0000000000000000000000000000000000000000 --- a/garnet/bin/iquery/formatters/text.cc +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "garnet/bin/iquery/formatters/text.h" - -#include <src/lib/fxl/strings/string_printf.h> - -#include <cstdio> -#include <sstream> - -#include "garnet/bin/iquery/options.h" -#include "lib/inspect/hierarchy.h" - -namespace iquery { - -namespace { - -#define INDENT_SIZE 2 - -inline std::string Indent(int indent) { - return std::string(indent * INDENT_SIZE, ' '); -} - -template <typename ArrayType> -std::string FormatArray(const ArrayType& array) { - std::ostringstream ss; - auto buckets = array.GetBuckets(); - if (!buckets.empty()) { - ss << "["; - bool first = true; - for (const auto& bucket : buckets) { - if (!first) { - ss << ", "; - } - first = false; - if (bucket.floor != 0 && - bucket.floor == std::numeric_limits<decltype(bucket.floor)>::min()) { - ss << "<min>=" << bucket.count; - } else { - ss << FormatNumericValue(bucket.floor) << "=" << bucket.count; - } - } - ss << "]"; - } else { - ss << "["; - bool first = true; - for (const auto& val : array.value()) { - if (!first) { - ss << ", "; - } - first = false; - ss << FormatNumericValue(val); - } - ss << "]"; - } - return ss.str(); -} - -std::string FormatMetricValue(const inspect::hierarchy::Metric& metric) { - switch (metric.format()) { - case inspect::hierarchy::MetricFormat::INT_ARRAY: - return FormatArray(metric.Get<inspect::hierarchy::IntArray>()); - case inspect::hierarchy::MetricFormat::UINT_ARRAY: - return FormatArray(metric.Get<inspect::hierarchy::UIntArray>()); - case inspect::hierarchy::MetricFormat::DOUBLE_ARRAY: - return FormatArray(metric.Get<inspect::hierarchy::DoubleArray>()); - default: - return FormatNumericMetricValue(metric); - } -} - -// This version exists so we can pass in the indentation and path from the entry -// point. -std::string RecursiveFormatCat(const Options& options, - const inspect::Source& entry_point, - const inspect::ObjectHierarchy& root, - std::vector<std::string>* path) { - // In each step of the indentation we output the path formatting. This is not - // equivalent to what formatters as JSON do, which will introduce a path - // entry under each object. - // This is mainly because this formatter is intended for human examination and - // it's not intended for easier parsing. - std::ostringstream ss; - size_t indent = path->size() + 1; - for (const auto& property : root.node().properties()) { - ss << Indent(indent) << FormatStringHexFallback(property.name()) << " = "; - - if (property.Contains<inspect::hierarchy::StringProperty>()) { - ss << FormatStringHexFallback( - property.Get<inspect::hierarchy::StringProperty>().value()) - << std::endl; - } else if (property.Contains<inspect::hierarchy::ByteVectorProperty>()) { - auto& val = - property.Get<inspect::hierarchy::ByteVectorProperty>().value(); - ss << FormatStringHexFallback( - {reinterpret_cast<const char*>(val.data()), val.size()}) - << std::endl; - } else { - ss << "<Unknown property format>" << std::endl; - } - } - - for (const auto& metric : root.node().metrics()) { - ss << Indent(indent) << FormatStringHexFallback(metric.name()) << " = " - << FormatMetricValue(metric) << std::endl; - } - - // We print recursively. The recursive nature of the cat called is already - // taken care of by now. - for (const auto& child : root.children()) { - path->push_back(child.node().name()); - ss << Indent(indent) - << FormatPath(options.path_format, - entry_point.GetLocation().NodePath(*path), - child.node().name()) - << ":" << std::endl; - ss << RecursiveFormatCat(options, entry_point, child, path); - path->pop_back(); - } - - return ss.str(); -} - -std::string FormatFind(const Options& options, - const std::vector<inspect::Source>& results) { - std::stringstream ss; - for (const auto& entry_point : results) { - entry_point.VisitObjectsInHierarchy( - [&](const std::vector<std::string>& path, - const inspect::ObjectHierarchy& hierarchy) { - ss << FormatPath(options.path_format, - entry_point.GetLocation().NodePath(path), - hierarchy.node().name()) - << std::endl; - }); - } - return ss.str(); -} - -std::string FormatLs(const Options& options, - const std::vector<inspect::Source>& results) { - std::stringstream ss; - for (const auto& entry_point : results) { - const auto& hierarchy = entry_point.GetHierarchy(); - for (const auto& child : hierarchy.children()) { - ss << FormatPath( - options.path_format, - entry_point.GetLocation().NodePath({child.node().name()}), - child.node().name()) - << std::endl; - } - } - return ss.str(); -} - -std::string FormatCat(const Options& options, - const std::vector<inspect::Source>& results) { - std::ostringstream ss; - for (const auto& entry_point : results) { - const auto& hierarchy = entry_point.GetHierarchy(); - ss << FormatPath(options.path_format, entry_point.GetLocation().NodePath(), - hierarchy.node().name()) - << ":" << std::endl; - std::vector<std::string> path_holder; - ss << RecursiveFormatCat(options, entry_point, hierarchy, &path_holder); - } - - return ss.str(); -} - -} // namespace - -std::string TextFormatter::Format(const Options& options, - const std::vector<inspect::Source>& results) { - switch (options.mode) { - case Options::Mode::CAT: - return FormatCat(options, results); - case Options::Mode::FIND: - return FormatFind(options, results); - case Options::Mode::LS: - return FormatLs(options, results); - case Options::Mode::UNSET: { - FXL_LOG(ERROR) << "Unset Mode"; - return ""; - } - } -} - -} // namespace iquery diff --git a/garnet/bin/iquery/formatters/text.h b/garnet/bin/iquery/formatters/text.h deleted file mode 100644 index 368306fce59ac6da49456b46083988fb5138ac4f..0000000000000000000000000000000000000000 --- a/garnet/bin/iquery/formatters/text.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef GARNET_BIN_IQUERY_FORMATTERS_TEXT_H_ -#define GARNET_BIN_IQUERY_FORMATTERS_TEXT_H_ - -#include <lib/inspect/query/source.h> - -#include <string> -#include <vector> - -#include "garnet/bin/iquery/formatter.h" - -namespace iquery { - -class TextFormatter : public Formatter { - public: - std::string Format(const Options&, - const std::vector<inspect::Source>&) override; -}; - -} // namespace iquery - -#endif // GARNET_BIN_IQUERY_FORMATTERS_TEXT_H_ diff --git a/garnet/bin/iquery/main.cc b/garnet/bin/iquery/main.cc index 79992b3110dcbf6e968314b06c47f69a65a76ed0..0ef0d6f05b6d78b3f0a1ac434728fbf0ac9a8be9 100644 --- a/garnet/bin/iquery/main.cc +++ b/garnet/bin/iquery/main.cc @@ -11,7 +11,6 @@ #include <iostream> -#include "garnet/bin/iquery/formatter.h" #include "garnet/bin/iquery/modes.h" int main(int argc, const char** argv) { @@ -61,9 +60,15 @@ int main(int argc, const char** argv) { source.SortHierarchy(); } } - // Formatter will handle the correct case according to the - // options values. - std::cout << options.formatter->Format(options, results); + + if (options.mode == iquery::Options::Mode::CAT) { + std::cout << options.formatter->FormatSourcesRecursive(results); + } else if (options.mode == iquery::Options::Mode::FIND) { + std::cout << options.formatter->FormatSourceLocations(results); + } else if (options.mode == iquery::Options::Mode::LS) { + std::cout << options.formatter->FormatChildListing(results); + } + loop.Quit(); }) .or_else([&loop] { diff --git a/garnet/bin/iquery/modes.h b/garnet/bin/iquery/modes.h index c4b8554969a936547dd2df1aa187a26be0d0a59d..90a012e3f9b316708c7f34a798f89780a8233db8 100644 --- a/garnet/bin/iquery/modes.h +++ b/garnet/bin/iquery/modes.h @@ -12,7 +12,6 @@ #include <vector> #include "garnet/bin/iquery/options.h" -#include "garnet/bin/iquery/utils.h" #include "garnet/public/lib/inspect/query/source.h" namespace iquery { diff --git a/garnet/bin/iquery/options.cc b/garnet/bin/iquery/options.cc index 218a1669b845ff8be0808e19215cbea2d9a521da..c007771abafe2d96b564a70752bb4e441c58f2e7 100644 --- a/garnet/bin/iquery/options.cc +++ b/garnet/bin/iquery/options.cc @@ -2,17 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <iostream> -#include <set> -#include <string> +#include "garnet/bin/iquery/options.h" +#include <lib/inspect/query/json_formatter.h> +#include <lib/inspect/query/text_formatter.h> +#include <src/lib/files/path.h> #include <src/lib/fxl/strings/concatenate.h> #include <src/lib/fxl/strings/substitute.h> -#include "src/lib/files/path.h" -#include "garnet/bin/iquery/formatters/json.h" -#include "garnet/bin/iquery/formatters/text.h" -#include "garnet/bin/iquery/options.h" +#include <iostream> +#include <set> +#include <string> + +#include "lib/inspect/query/formatter.h" namespace iquery { @@ -45,12 +47,18 @@ Options::FormatterType GetFormatterType(const fxl::CommandLine& cmd_line) { } } -std::unique_ptr<Formatter> CreateFormatter(Options::FormatterType type) { +std::unique_ptr<inspect::Formatter> CreateFormatter( + Options::FormatterType type, + const inspect::Formatter::PathFormat& path_format) { switch (type) { - case Options::FormatterType::TEXT: - return std::make_unique<TextFormatter>(); - case Options::FormatterType::JSON: - return std::make_unique<JsonFormatter>(); + case Options::FormatterType::TEXT: { + inspect::TextFormatter::Options options; + return std::make_unique<inspect::TextFormatter>(options, path_format); + } + case Options::FormatterType::JSON: { + inspect::JsonFormatter::Options options; + return std::make_unique<inspect::JsonFormatter>(options, path_format); + } case Options::FormatterType::UNSET: return nullptr; } @@ -77,22 +85,25 @@ Options::Options(const fxl::CommandLine& command_line) { else if (mode == Mode::UNSET) SetMode(command_line, Mode::CAT); - formatter_type = GetFormatterType(command_line); - formatter = CreateFormatter(formatter_type); - if (!formatter) - return; - // Path formatting options. - path_format = PathFormatting::NONE; + path_format = inspect::Formatter::PathFormat::NONE; if (command_line.HasOption("full_paths")) { - path_format = PathFormatting::FULL; + path_format = inspect::Formatter::PathFormat::FULL; } if (command_line.HasOption("absolute_paths")) { - path_format = PathFormatting::ABSOLUTE; + path_format = inspect::Formatter::PathFormat::ABSOLUTE; } + // Find has a special case, where none path formatting is not really useful. - if (path_format == PathFormatting::NONE && mode == Mode::FIND) - path_format = PathFormatting::FULL; + if (path_format == inspect::Formatter::PathFormat::NONE && + mode == Mode::FIND) { + path_format = inspect::Formatter::PathFormat::FULL; + } + + formatter_type = GetFormatterType(command_line); + formatter = CreateFormatter(formatter_type, path_format); + if (!formatter) + return; recursive = command_line.HasOption("recursive"); sort = command_line.HasOption("sort"); diff --git a/garnet/bin/iquery/options.h b/garnet/bin/iquery/options.h index 2a1e6805c25209dd3e5103c8990b2c0ccd58e392..cf37cb12e3948d72add7bac825ef1e4d75d097d8 100644 --- a/garnet/bin/iquery/options.h +++ b/garnet/bin/iquery/options.h @@ -5,10 +5,11 @@ #ifndef GARNET_BIN_IQUERY_OPTIONS_H_ #define GARNET_BIN_IQUERY_OPTIONS_H_ -#include <memory> - +#include <lib/inspect/query/formatter.h> #include <src/lib/fxl/command_line.h> +#include <memory> + namespace iquery { class Formatter; @@ -26,11 +27,6 @@ class Options { JSON, TEXT, }; - enum class PathFormatting { - NONE, // Object name (filename). - FULL, // Relative path from the CWD. - ABSOLUTE, // Absolute path starting from root "/". - }; // Directory to change to before executing commands. std::string chdir; @@ -39,7 +35,8 @@ class Options { Options::Mode mode = Options::Mode::UNSET; // Path formatting mode. - PathFormatting path_format = Options::PathFormatting::NONE; + inspect::Formatter::PathFormat path_format = + inspect::Formatter::PathFormat::NONE; // If true, execute mode recursively. bool recursive = false; @@ -54,7 +51,7 @@ class Options { FormatterType formatter_type; // Instance of the formatter. - std::unique_ptr<iquery::Formatter> formatter; + std::unique_ptr<inspect::Formatter> formatter; // Create |Options| by parsing the given command line. Options(const fxl::CommandLine& command_line); diff --git a/garnet/bin/iquery/testing/example.cc b/garnet/bin/iquery/testing/example.cc index dc87f9fde8476da0a702c2f4930c896d2a20d2c1..6f81614550ec832234c0431e36156fff0e572d25 100644 --- a/garnet/bin/iquery/testing/example.cc +++ b/garnet/bin/iquery/testing/example.cc @@ -68,11 +68,6 @@ class Table { object_name_ = object_.CreateStringProperty("object_name", "Example Table"); binary_data_ = object_.CreateByteVectorProperty( "binary_data", std::vector<uint8_t>({0x20, 0x0, 0x11, 0x12, 0x5})); - binary_key_ = object_.CreateStringProperty( - std::string("\x05\x01\x03", 3), - "The key of this value is a binary value."); - binary_key_and_data_ = object_.CreateByteVectorProperty( - std::string("\x05\x01\x02", 3), std::vector<uint8_t>({0x1, 0x2})); // Add default rows and columns to the table. const int total = row_count * col_count; @@ -98,8 +93,6 @@ class Table { inspect::Object object_; inspect::StringProperty object_name_; inspect::ByteVectorProperty binary_data_; - inspect::StringProperty binary_key_; - inspect::ByteVectorProperty binary_key_and_data_; std::vector<Row> rows_; }; diff --git a/garnet/bin/iquery/testing/goldens/cat-recursive-absolute.txt b/garnet/bin/iquery/testing/goldens/cat-recursive-absolute.txt index 1fffd7cfa5b2a4198a656b66a4a1ef06b344e428..cc412dbd4353b1cc39abc358fd44d2a59116d58d 100644 --- a/garnet/bin/iquery/testing/goldens/cat-recursive-absolute.txt +++ b/garnet/bin/iquery/testing/goldens/cat-recursive-absolute.txt @@ -1,11 +1,6 @@ iquery --recursive --absolute_paths objects /hub/r/test/*/c/iquery_example_component.cmx/*/out/objects: /hub/r/test/*/c/iquery_example_component.cmx/*/out/objects#table:0x0: - Binary: -0000 05 01 02 ... = Binary: -0000 01 02 .. - Binary: -0000 05 01 03 ... = The key of this value is a binary value. binary_data = Binary: 0000 20 00 11 12 05 .... object_name = Example Table diff --git a/garnet/bin/iquery/testing/goldens/cat-recursive-full.txt b/garnet/bin/iquery/testing/goldens/cat-recursive-full.txt index 0598fd7e1102059b79f831f6d3d75c8075d5785a..35f9e41ec52444144f8c23201128d9c0e61118e7 100644 --- a/garnet/bin/iquery/testing/goldens/cat-recursive-full.txt +++ b/garnet/bin/iquery/testing/goldens/cat-recursive-full.txt @@ -1,11 +1,6 @@ iquery --recursive --full_paths objects objects: objects#table:0x0: - Binary: -0000 05 01 02 ... = Binary: -0000 01 02 .. - Binary: -0000 05 01 03 ... = The key of this value is a binary value. binary_data = Binary: 0000 20 00 11 12 05 .... object_name = Example Table diff --git a/garnet/bin/iquery/testing/goldens/cat-recursive-json-absolute.txt b/garnet/bin/iquery/testing/goldens/cat-recursive-json-absolute.txt index bef75724a73148fd1efc8fb2364a0fc77512996d..3a355d4b2b18cff9ca825170553582df929857db 100644 --- a/garnet/bin/iquery/testing/goldens/cat-recursive-json-absolute.txt +++ b/garnet/bin/iquery/testing/goldens/cat-recursive-json-absolute.txt @@ -5,93 +5,91 @@ iquery --recursive --format=json --absolute_paths objects "contents": { "root": { "table:0x0": { - "b64:BQEC": "b64:AQI=", - "b64:BQED": "The key of this value is a binary value.", "binary_data": "b64:IAAREgU=", "object_name": "Example Table", "row:0x1": { "cell:0x2": { "name": "(0,0)", - "double_value": "6.666667", - "value": "0" + "double_value": 6.666666, + "value": 0 }, "cell:0x3": { "name": "(0,1)", - "double_value": "13.333333", - "value": "0" + "double_value": 13.333333, + "value": 0 }, "cell:0x4": { "name": "(0,2)", - "double_value": "20.000000", - "value": "0" + "double_value": 20.0, + "value": 0 } }, "row:0x11": { "cell:0x12": { "name": "(4,0)", - "double_value": "86.666667", - "value": "0" + "double_value": 86.666666, + "value": 0 }, "cell:0x13": { "name": "(4,1)", - "double_value": "93.333333", - "value": "4" + "double_value": 93.333333, + "value": 4 }, "cell:0x14": { "name": "(4,2)", - "double_value": "100.000000", - "value": "8" + "double_value": 100.0, + "value": 8 } }, "row:0x5": { "cell:0x6": { "name": "(1,0)", - "double_value": "26.666667", - "value": "0" + "double_value": 26.666666, + "value": 0 }, "cell:0x7": { "name": "(1,1)", - "double_value": "33.333333", - "value": "1" + "double_value": 33.333333, + "value": 1 }, "cell:0x8": { "name": "(1,2)", - "double_value": "40.000000", - "value": "2" + "double_value": 40.0, + "value": 2 } }, "row:0x9": { "cell:0xa": { "name": "(2,0)", - "double_value": "46.666667", - "value": "0" + "double_value": 46.666666, + "value": 0 }, "cell:0xb": { "name": "(2,1)", - "double_value": "53.333333", - "value": "2" + "double_value": 53.333333, + "value": 2 }, "cell:0xc": { "name": "(2,2)", - "double_value": "60.000000", - "value": "4" + "double_value": 60.0, + "value": 4 } }, "row:0xd": { "cell:0x10": { "name": "(3,2)", - "double_value": "80.000000", - "value": "6" + "double_value": 80.0, + "value": 6 }, "cell:0xe": { "name": "(3,0)", - "double_value": "66.666667", - "value": "0" + "double_value": 66.666666, + "value": 0 }, "cell:0xf": { "name": "(3,1)", - "double_value": "73.333333", - "value": "3" + "double_value": 73.333333, + "value": 3 } } } diff --git a/garnet/bin/iquery/testing/goldens/cat-recursive-json-full.txt b/garnet/bin/iquery/testing/goldens/cat-recursive-json-full.txt index 48f7133bd8b75d79906f3a21a91deca9a94a7565..cde9ce2d4c2a5b51b214bd8368327cc98009b557 100644 --- a/garnet/bin/iquery/testing/goldens/cat-recursive-json-full.txt +++ b/garnet/bin/iquery/testing/goldens/cat-recursive-json-full.txt @@ -5,93 +5,91 @@ iquery --recursive --format=json --full_paths objects "contents": { "root": { "table:0x0": { - "b64:BQEC": "b64:AQI=", - "b64:BQED": "The key of this value is a binary value.", "binary_data": "b64:IAAREgU=", "object_name": "Example Table", "row:0x1": { "cell:0x2": { "name": "(0,0)", - "double_value": "6.666667", - "value": "0" + "double_value": 6.666666, + "value": 0 }, "cell:0x3": { "name": "(0,1)", - "double_value": "13.333333", - "value": "0" + "double_value": 13.333333, + "value": 0 }, "cell:0x4": { "name": "(0,2)", - "double_value": "20.000000", - "value": "0" + "double_value": 20.0, + "value": 0 } }, "row:0x11": { "cell:0x12": { "name": "(4,0)", - "double_value": "86.666667", - "value": "0" + "double_value": 86.666666, + "value": 0 }, "cell:0x13": { "name": "(4,1)", - "double_value": "93.333333", - "value": "4" + "double_value": 93.333333, + "value": 4 }, "cell:0x14": { "name": "(4,2)", - "double_value": "100.000000", - "value": "8" + "double_value": 100.0, + "value": 8 } }, "row:0x5": { "cell:0x6": { "name": "(1,0)", - "double_value": "26.666667", - "value": "0" + "double_value": 26.666666, + "value": 0 }, "cell:0x7": { "name": "(1,1)", - "double_value": "33.333333", - "value": "1" + "double_value": 33.333333, + "value": 1 }, "cell:0x8": { "name": "(1,2)", - "double_value": "40.000000", - "value": "2" + "double_value": 40.0, + "value": 2 } }, "row:0x9": { "cell:0xa": { "name": "(2,0)", - "double_value": "46.666667", - "value": "0" + "double_value": 46.666666, + "value": 0 }, "cell:0xb": { "name": "(2,1)", - "double_value": "53.333333", - "value": "2" + "double_value": 53.333333, + "value": 2 }, "cell:0xc": { "name": "(2,2)", - "double_value": "60.000000", - "value": "4" + "double_value": 60.0, + "value": 4 } }, "row:0xd": { "cell:0x10": { "name": "(3,2)", - "double_value": "80.000000", - "value": "6" + "double_value": 80.0, + "value": 6 }, "cell:0xe": { "name": "(3,0)", - "double_value": "66.666667", - "value": "0" + "double_value": 66.666666, + "value": 0 }, "cell:0xf": { "name": "(3,1)", - "double_value": "73.333333", - "value": "3" + "double_value": 73.333333, + "value": 3 } } } diff --git a/garnet/bin/iquery/testing/goldens/cat-recursive-json.txt b/garnet/bin/iquery/testing/goldens/cat-recursive-json.txt index 1be5d530bd5588c241d37bb2294c428b0f8f31d1..80996382b3f6f831f3f796669a37e35e217e9b33 100644 --- a/garnet/bin/iquery/testing/goldens/cat-recursive-json.txt +++ b/garnet/bin/iquery/testing/goldens/cat-recursive-json.txt @@ -5,93 +5,91 @@ iquery --recursive --format=json objects "contents": { "root": { "table:0x0": { - "b64:BQEC": "b64:AQI=", - "b64:BQED": "The key of this value is a binary value.", "binary_data": "b64:IAAREgU=", "object_name": "Example Table", "row:0x1": { "cell:0x2": { "name": "(0,0)", - "double_value": "6.666667", - "value": "0" + "double_value": 6.666666, + "value": 0 }, "cell:0x3": { "name": "(0,1)", - "double_value": "13.333333", - "value": "0" + "double_value": 13.333333, + "value": 0 }, "cell:0x4": { "name": "(0,2)", - "double_value": "20.000000", - "value": "0" + "double_value": 20.0, + "value": 0 } }, "row:0x11": { "cell:0x12": { "name": "(4,0)", - "double_value": "86.666667", - "value": "0" + "double_value": 86.666666, + "value": 0 }, "cell:0x13": { "name": "(4,1)", - "double_value": "93.333333", - "value": "4" + "double_value": 93.333333, + "value": 4 }, "cell:0x14": { "name": "(4,2)", - "double_value": "100.000000", - "value": "8" + "double_value": 100.0, + "value": 8 } }, "row:0x5": { "cell:0x6": { "name": "(1,0)", - "double_value": "26.666667", - "value": "0" + "double_value": 26.666666, + "value": 0 }, "cell:0x7": { "name": "(1,1)", - "double_value": "33.333333", - "value": "1" + "double_value": 33.333333, + "value": 1 }, "cell:0x8": { "name": "(1,2)", - "double_value": "40.000000", - "value": "2" + "double_value": 40.0, + "value": 2 } }, "row:0x9": { "cell:0xa": { "name": "(2,0)", - "double_value": "46.666667", - "value": "0" + "double_value": 46.666666, + "value": 0 }, "cell:0xb": { "name": "(2,1)", - "double_value": "53.333333", - "value": "2" + "double_value": 53.333333, + "value": 2 }, "cell:0xc": { "name": "(2,2)", - "double_value": "60.000000", - "value": "4" + "double_value": 60.0, + "value": 4 } }, "row:0xd": { "cell:0x10": { "name": "(3,2)", - "double_value": "80.000000", - "value": "6" + "double_value": 80.0, + "value": 6 }, "cell:0xe": { "name": "(3,0)", - "double_value": "66.666667", - "value": "0" + "double_value": 66.666666, + "value": 0 }, "cell:0xf": { "name": "(3,1)", - "double_value": "73.333333", - "value": "3" + "double_value": 73.333333, + "value": 3 } } } diff --git a/garnet/bin/iquery/testing/goldens/cat-recursive.txt b/garnet/bin/iquery/testing/goldens/cat-recursive.txt index 36d3fe80153980039637bb76a6afabd242d0ca12..3c7571e1359ef61fea4c1ec73b5b84acf87fd11b 100644 --- a/garnet/bin/iquery/testing/goldens/cat-recursive.txt +++ b/garnet/bin/iquery/testing/goldens/cat-recursive.txt @@ -1,11 +1,6 @@ iquery --recursive objects root: table:0x0: - Binary: -0000 05 01 02 ... = Binary: -0000 01 02 .. - Binary: -0000 05 01 03 ... = The key of this value is a binary value. binary_data = Binary: 0000 20 00 11 12 05 .... object_name = Example Table diff --git a/garnet/bin/iquery/testing/goldens/cat-single-absolute.txt b/garnet/bin/iquery/testing/goldens/cat-single-absolute.txt index 7b5d3c59de253ac17dd67092dfab574d83a49746..dcf67db86f110037be24e362005a9309340b4d99 100644 --- a/garnet/bin/iquery/testing/goldens/cat-single-absolute.txt +++ b/garnet/bin/iquery/testing/goldens/cat-single-absolute.txt @@ -1,11 +1,6 @@ # Absolute paths gives the full path to each object from the root directory. iquery --absolute_paths objects#table:0x0 /hub/r/test/*/c/iquery_example_component.cmx/*/out/objects#table:0x0: - Binary: -0000 05 01 02 ... = Binary: -0000 01 02 .. - Binary: -0000 05 01 03 ... = The key of this value is a binary value. binary_data = Binary: 0000 20 00 11 12 05 .... object_name = Example Table diff --git a/garnet/bin/iquery/testing/goldens/cat-single-full.txt b/garnet/bin/iquery/testing/goldens/cat-single-full.txt index 00662fa0fb040c5c0500131de0ccb58da72963e2..7326681753a35c45ac7ab84bde3ed11962f7c669 100644 --- a/garnet/bin/iquery/testing/goldens/cat-single-full.txt +++ b/garnet/bin/iquery/testing/goldens/cat-single-full.txt @@ -1,11 +1,6 @@ # Full paths lists the relative path to the object listed. iquery --full_paths objects#table:0x0 objects#table:0x0: - Binary: -0000 05 01 02 ... = Binary: -0000 01 02 .. - Binary: -0000 05 01 03 ... = The key of this value is a binary value. binary_data = Binary: 0000 20 00 11 12 05 .... object_name = Example Table diff --git a/garnet/bin/iquery/testing/goldens/cat-single.txt b/garnet/bin/iquery/testing/goldens/cat-single.txt index 63b7cb68723670b14cee4746b1b61f6640ad6a21..0ccf736db8b0085a56b78718f9bdacb7d7016e65 100644 --- a/garnet/bin/iquery/testing/goldens/cat-single.txt +++ b/garnet/bin/iquery/testing/goldens/cat-single.txt @@ -1,11 +1,6 @@ # Output the object properties for one object in text format. iquery objects#table:0x0 table:0x0: - Binary: -0000 05 01 02 ... = Binary: -0000 01 02 .. - Binary: -0000 05 01 03 ... = The key of this value is a binary value. binary_data = Binary: 0000 20 00 11 12 05 .... object_name = Example Table diff --git a/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-absolute.txt b/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-absolute.txt index 80457f302702c5b429ca775f6c91fb70597e9f50..e716b021fcceaaa869a75a08dc054786ee23ebb1 100644 --- a/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-absolute.txt +++ b/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-absolute.txt @@ -3,18 +3,13 @@ iquery --recursive --absolute_paths --sort objects/root.inspect array:0x15 = [1, 10, -3] array:0x16 = [1, 10, 2] array:0x17 = [0.250000, 1.250000, -0.750000] - histogram:0x18 = [<min>=10, -10=5, -5=5, 0=5, 5=15] - histogram:0x19 = [0=5, 5=5, 10=5, 15=5, 20=20] - histogram:0x1a = [-inf=11, 0.000000=5, 0.500000=5, 1.000000=4, 1.500000=15] - histogram:0x1b = [<min>=10, -10=5, -5=10, 5=15, 25=0] - histogram:0x1c = [0=1, 1=1, 2=2, 4=4, 8=32] - histogram:0x1d = [-inf=11, 0.000000=12, 1.250000=17, 5.000000=0, 16.250000=0] + histogram:0x18 = [[<min>,-10)=10, [-10,-5)=5, [-5,0)=5, [0,5)=5, [5,<max>)=15] + histogram:0x19 = [[0,5)=5, [5,10)=5, [10,15)=5, [15,20)=5, [20,<max>)=20] + histogram:0x1a = [[-inf,0.000000)=11, [0.000000,0.500000)=5, [0.500000,1.000000)=5, [1.000000,1.500000)=4, [1.500000,inf)=15] + histogram:0x1b = [[<min>,-10)=10, [-10,-5)=5, [-5,5)=10, [5,25)=15, [25,<max>)=0] + histogram:0x1c = [[0,1)=1, [1,2)=1, [2,4)=2, [4,8)=4, [8,<max>)=32] + histogram:0x1d = [[-inf,0.000000)=11, [0.000000,1.250000)=12, [1.250000,5.000000)=17, [5.000000,16.250000)=0, [16.250000,inf)=0] /hub/r/test/*/c/iquery_example_component.cmx/*/out/objects/root.inspect#table:0x0: - Binary: -0000 05 01 02 ... = Binary: -0000 01 02 .. - Binary: -0000 05 01 03 ... = The key of this value is a binary value. binary_data = Binary: 0000 20 00 11 12 05 .... object_name = Example Table diff --git a/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-full.txt b/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-full.txt index 7a1f541b884c9f5adf5e5f33f4ce62677bae4ddf..7a74af961462512ab6aeaccec5c35bef3e54fbe9 100644 --- a/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-full.txt +++ b/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-full.txt @@ -3,18 +3,13 @@ objects/root.inspect: array:0x15 = [1, 10, -3] array:0x16 = [1, 10, 2] array:0x17 = [0.250000, 1.250000, -0.750000] - histogram:0x18 = [<min>=10, -10=5, -5=5, 0=5, 5=15] - histogram:0x19 = [0=5, 5=5, 10=5, 15=5, 20=20] - histogram:0x1a = [-inf=11, 0.000000=5, 0.500000=5, 1.000000=4, 1.500000=15] - histogram:0x1b = [<min>=10, -10=5, -5=10, 5=15, 25=0] - histogram:0x1c = [0=1, 1=1, 2=2, 4=4, 8=32] - histogram:0x1d = [-inf=11, 0.000000=12, 1.250000=17, 5.000000=0, 16.250000=0] + histogram:0x18 = [[<min>,-10)=10, [-10,-5)=5, [-5,0)=5, [0,5)=5, [5,<max>)=15] + histogram:0x19 = [[0,5)=5, [5,10)=5, [10,15)=5, [15,20)=5, [20,<max>)=20] + histogram:0x1a = [[-inf,0.000000)=11, [0.000000,0.500000)=5, [0.500000,1.000000)=5, [1.000000,1.500000)=4, [1.500000,inf)=15] + histogram:0x1b = [[<min>,-10)=10, [-10,-5)=5, [-5,5)=10, [5,25)=15, [25,<max>)=0] + histogram:0x1c = [[0,1)=1, [1,2)=1, [2,4)=2, [4,8)=4, [8,<max>)=32] + histogram:0x1d = [[-inf,0.000000)=11, [0.000000,1.250000)=12, [1.250000,5.000000)=17, [5.000000,16.250000)=0, [16.250000,inf)=0] objects/root.inspect#table:0x0: - Binary: -0000 05 01 02 ... = Binary: -0000 01 02 .. - Binary: -0000 05 01 03 ... = The key of this value is a binary value. binary_data = Binary: 0000 20 00 11 12 05 .... object_name = Example Table diff --git a/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-json-absolute.txt b/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-json-absolute.txt index 8a8b8e065130d294bbe65024ccf85d7ac4fad059..34b16eae75fa9e344b5c2b53affc9574b1b3d5f1 100644 --- a/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-json-absolute.txt +++ b/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-json-absolute.txt @@ -5,282 +5,280 @@ iquery --recursive --format=json --absolute_paths --sort objects/root.inspect "contents": { "root": { "array:0x15": [ - "1", - "10", - "-3" + 1, + 10, + -3 ], "array:0x16": [ - "1", - "10", - "2" + 1, + 10, + 2 ], "array:0x17": [ - "0.250000", - "1.250000", - "-0.750000" + 0.25, + 1.25, + -0.75 ], "histogram:0x18": { "buckets": [ { - "floor": "-9223372036854775808", - "upper_bound": "-10", - "count": "10" + "floor": -9223372036854775808, + "upper_bound": -10, + "count": 10 }, { - "floor": "-10", - "upper_bound": "-5", - "count": "5" + "floor": -10, + "upper_bound": -5, + "count": 5 }, { - "floor": "-5", - "upper_bound": "0", - "count": "5" + "floor": -5, + "upper_bound": 0, + "count": 5 }, { - "floor": "0", - "upper_bound": "5", - "count": "5" + "floor": 0, + "upper_bound": 5, + "count": 5 }, { - "floor": "5", - "upper_bound": "9223372036854775807", - "count": "15" + "floor": 5, + "upper_bound": 9223372036854775807, + "count": 15 } ] }, "histogram:0x19": { "buckets": [ { - "floor": "0", - "upper_bound": "5", - "count": "5" + "floor": 0, + "upper_bound": 5, + "count": 5 }, { - "floor": "5", - "upper_bound": "10", - "count": "5" + "floor": 5, + "upper_bound": 10, + "count": 5 }, { - "floor": "10", - "upper_bound": "15", - "count": "5" + "floor": 10, + "upper_bound": 15, + "count": 5 }, { - "floor": "15", - "upper_bound": "20", - "count": "5" + "floor": 15, + "upper_bound": 20, + "count": 5 }, { - "floor": "20", - "upper_bound": "18446744073709551615", - "count": "20" + "floor": 20, + "upper_bound": 18446744073709551615, + "count": 20 } ] }, "histogram:0x1a": { "buckets": [ { - "floor": "-inf", - "upper_bound": "0.000000", - "count": "11.000000" + "floor": "-Infinity", + "upper_bound": 0.0, + "count": 11.0 }, { - "floor": "0.000000", - "upper_bound": "0.500000", - "count": "5.000000" + "floor": 0.0, + "upper_bound": 0.5, + "count": 5.0 }, { - "floor": "0.500000", - "upper_bound": "1.000000", - "count": "5.000000" + "floor": 0.5, + "upper_bound": 1.0, + "count": 5.0 }, { - "floor": "1.000000", - "upper_bound": "1.500000", - "count": "4.000000" + "floor": 1.0, + "upper_bound": 1.5, + "count": 4.0 }, { - "floor": "1.500000", - "upper_bound": "inf", - "count": "15.000000" + "floor": 1.5, + "upper_bound": "Infinity", + "count": 15.0 } ] }, "histogram:0x1b": { "buckets": [ { - "floor": "-9223372036854775808", - "upper_bound": "-10", - "count": "10" + "floor": -9223372036854775808, + "upper_bound": -10, + "count": 10 }, { - "floor": "-10", - "upper_bound": "-5", - "count": "5" + "floor": -10, + "upper_bound": -5, + "count": 5 }, { - "floor": "-5", - "upper_bound": "5", - "count": "10" + "floor": -5, + "upper_bound": 5, + "count": 10 }, { - "floor": "5", - "upper_bound": "25", - "count": "15" + "floor": 5, + "upper_bound": 25, + "count": 15 }, { - "floor": "25", - "upper_bound": "9223372036854775807", - "count": "0" + "floor": 25, + "upper_bound": 9223372036854775807, + "count": 0 } ] }, "histogram:0x1c": { "buckets": [ { - "floor": "0", - "upper_bound": "1", - "count": "1" + "floor": 0, + "upper_bound": 1, + "count": 1 }, { - "floor": "1", - "upper_bound": "2", - "count": "1" + "floor": 1, + "upper_bound": 2, + "count": 1 }, { - "floor": "2", - "upper_bound": "4", - "count": "2" + "floor": 2, + "upper_bound": 4, + "count": 2 }, { - "floor": "4", - "upper_bound": "8", - "count": "4" + "floor": 4, + "upper_bound": 8, + "count": 4 }, { - "floor": "8", - "upper_bound": "18446744073709551615", - "count": "32" + "floor": 8, + "upper_bound": 18446744073709551615, + "count": 32 } ] }, "histogram:0x1d": { "buckets": [ { - "floor": "-inf", - "upper_bound": "0.000000", - "count": "11.000000" + "floor": "-Infinity", + "upper_bound": 0.0, + "count": 11.0 }, { - "floor": "0.000000", - "upper_bound": "1.250000", - "count": "12.000000" + "floor": 0.0, + "upper_bound": 1.25, + "count": 12.0 }, { - "floor": "1.250000", - "upper_bound": "5.000000", - "count": "17.000000" + "floor": 1.25, + "upper_bound": 5.0, + "count": 17.0 }, { - "floor": "5.000000", - "upper_bound": "16.250000", - "count": "0.000000" + "floor": 5.0, + "upper_bound": 16.25, + "count": 0.0 }, { - "floor": "16.250000", - "upper_bound": "inf", - "count": "0.000000" + "floor": 16.25, + "upper_bound": "Infinity", + "count": 0.0 } ] }, "table:0x0": { - "b64:BQEC": "b64:AQI=", - "b64:BQED": "The key of this value is a binary value.", "binary_data": "b64:IAAREgU=", "object_name": "Example Table", "row:0x1": { "cell:0x2": { "name": "(0,0)", - "double_value": "6.666667", - "value": "0" + "double_value": 6.666666, + "value": 0 }, "cell:0x3": { "name": "(0,1)", - "double_value": "13.333333", - "value": "0" + "double_value": 13.333333, + "value": 0 }, "cell:0x4": { "name": "(0,2)", - "double_value": "20.000000", - "value": "0" + "double_value": 20.0, + "value": 0 } }, "row:0x11": { "cell:0x12": { "name": "(4,0)", - "double_value": "86.666667", - "value": "0" + "double_value": 86.666666, + "value": 0 }, "cell:0x13": { "name": "(4,1)", - "double_value": "93.333333", - "value": "4" + "double_value": 93.333333, + "value": 4 }, "cell:0x14": { "name": "(4,2)", - "double_value": "100.000000", - "value": "8" + "double_value": 100.0, + "value": 8 } }, "row:0x5": { "cell:0x6": { "name": "(1,0)", - "double_value": "26.666667", - "value": "0" + "double_value": 26.666666, + "value": 0 }, "cell:0x7": { "name": "(1,1)", - "double_value": "33.333333", - "value": "1" + "double_value": 33.333333, + "value": 1 }, "cell:0x8": { "name": "(1,2)", - "double_value": "40.000000", - "value": "2" + "double_value": 40.0, + "value": 2 } }, "row:0x9": { "cell:0xa": { "name": "(2,0)", - "double_value": "46.666667", - "value": "0" + "double_value": 46.666666, + "value": 0 }, "cell:0xb": { "name": "(2,1)", - "double_value": "53.333333", - "value": "2" + "double_value": 53.333333, + "value": 2 }, "cell:0xc": { "name": "(2,2)", - "double_value": "60.000000", - "value": "4" + "double_value": 60.0, + "value": 4 } }, "row:0xd": { "cell:0x10": { "name": "(3,2)", - "double_value": "80.000000", - "value": "6" + "double_value": 80.0, + "value": 6 }, "cell:0xe": { "name": "(3,0)", - "double_value": "66.666667", - "value": "0" + "double_value": 66.666666, + "value": 0 }, "cell:0xf": { "name": "(3,1)", - "double_value": "73.333333", - "value": "3" + "double_value": 73.333333, + "value": 3 } } } diff --git a/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-json-full.txt b/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-json-full.txt index a761fef12129a36d7c204099f0d8d79aeb610e97..742ad3629508c1d22e380582ac3a4dabfd7668ee 100644 --- a/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-json-full.txt +++ b/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-json-full.txt @@ -5,282 +5,280 @@ iquery --recursive --format=json --full_paths --sort objects/root.inspect "contents": { "root": { "array:0x15": [ - "1", - "10", - "-3" + 1, + 10, + -3 ], "array:0x16": [ - "1", - "10", - "2" + 1, + 10, + 2 ], "array:0x17": [ - "0.250000", - "1.250000", - "-0.750000" + 0.25, + 1.25, + -0.75 ], "histogram:0x18": { "buckets": [ { - "floor": "-9223372036854775808", - "upper_bound": "-10", - "count": "10" + "floor": -9223372036854775808, + "upper_bound": -10, + "count": 10 }, { - "floor": "-10", - "upper_bound": "-5", - "count": "5" + "floor": -10, + "upper_bound": -5, + "count": 5 }, { - "floor": "-5", - "upper_bound": "0", - "count": "5" + "floor": -5, + "upper_bound": 0, + "count": 5 }, { - "floor": "0", - "upper_bound": "5", - "count": "5" + "floor": 0, + "upper_bound": 5, + "count": 5 }, { - "floor": "5", - "upper_bound": "9223372036854775807", - "count": "15" + "floor": 5, + "upper_bound": 9223372036854775807, + "count": 15 } ] }, "histogram:0x19": { "buckets": [ { - "floor": "0", - "upper_bound": "5", - "count": "5" + "floor": 0, + "upper_bound": 5, + "count": 5 }, { - "floor": "5", - "upper_bound": "10", - "count": "5" + "floor": 5, + "upper_bound": 10, + "count": 5 }, { - "floor": "10", - "upper_bound": "15", - "count": "5" + "floor": 10, + "upper_bound": 15, + "count": 5 }, { - "floor": "15", - "upper_bound": "20", - "count": "5" + "floor": 15, + "upper_bound": 20, + "count": 5 }, { - "floor": "20", - "upper_bound": "18446744073709551615", - "count": "20" + "floor": 20, + "upper_bound": 18446744073709551615, + "count": 20 } ] }, "histogram:0x1a": { "buckets": [ { - "floor": "-inf", - "upper_bound": "0.000000", - "count": "11.000000" + "floor": "-Infinity", + "upper_bound": 0.0, + "count": 11.0 }, { - "floor": "0.000000", - "upper_bound": "0.500000", - "count": "5.000000" + "floor": 0.0, + "upper_bound": 0.5, + "count": 5.0 }, { - "floor": "0.500000", - "upper_bound": "1.000000", - "count": "5.000000" + "floor": 0.5, + "upper_bound": 1.0, + "count": 5.0 }, { - "floor": "1.000000", - "upper_bound": "1.500000", - "count": "4.000000" + "floor": 1.0, + "upper_bound": 1.5, + "count": 4.0 }, { - "floor": "1.500000", - "upper_bound": "inf", - "count": "15.000000" + "floor": 1.5, + "upper_bound": "Infinity", + "count": 15.0 } ] }, "histogram:0x1b": { "buckets": [ { - "floor": "-9223372036854775808", - "upper_bound": "-10", - "count": "10" + "floor": -9223372036854775808, + "upper_bound": -10, + "count": 10 }, { - "floor": "-10", - "upper_bound": "-5", - "count": "5" + "floor": -10, + "upper_bound": -5, + "count": 5 }, { - "floor": "-5", - "upper_bound": "5", - "count": "10" + "floor": -5, + "upper_bound": 5, + "count": 10 }, { - "floor": "5", - "upper_bound": "25", - "count": "15" + "floor": 5, + "upper_bound": 25, + "count": 15 }, { - "floor": "25", - "upper_bound": "9223372036854775807", - "count": "0" + "floor": 25, + "upper_bound": 9223372036854775807, + "count": 0 } ] }, "histogram:0x1c": { "buckets": [ { - "floor": "0", - "upper_bound": "1", - "count": "1" + "floor": 0, + "upper_bound": 1, + "count": 1 }, { - "floor": "1", - "upper_bound": "2", - "count": "1" + "floor": 1, + "upper_bound": 2, + "count": 1 }, { - "floor": "2", - "upper_bound": "4", - "count": "2" + "floor": 2, + "upper_bound": 4, + "count": 2 }, { - "floor": "4", - "upper_bound": "8", - "count": "4" + "floor": 4, + "upper_bound": 8, + "count": 4 }, { - "floor": "8", - "upper_bound": "18446744073709551615", - "count": "32" + "floor": 8, + "upper_bound": 18446744073709551615, + "count": 32 } ] }, "histogram:0x1d": { "buckets": [ { - "floor": "-inf", - "upper_bound": "0.000000", - "count": "11.000000" + "floor": "-Infinity", + "upper_bound": 0.0, + "count": 11.0 }, { - "floor": "0.000000", - "upper_bound": "1.250000", - "count": "12.000000" + "floor": 0.0, + "upper_bound": 1.25, + "count": 12.0 }, { - "floor": "1.250000", - "upper_bound": "5.000000", - "count": "17.000000" + "floor": 1.25, + "upper_bound": 5.0, + "count": 17.0 }, { - "floor": "5.000000", - "upper_bound": "16.250000", - "count": "0.000000" + "floor": 5.0, + "upper_bound": 16.25, + "count": 0.0 }, { - "floor": "16.250000", - "upper_bound": "inf", - "count": "0.000000" + "floor": 16.25, + "upper_bound": "Infinity", + "count": 0.0 } ] }, "table:0x0": { - "b64:BQEC": "b64:AQI=", - "b64:BQED": "The key of this value is a binary value.", "binary_data": "b64:IAAREgU=", "object_name": "Example Table", "row:0x1": { "cell:0x2": { "name": "(0,0)", - "double_value": "6.666667", - "value": "0" + "double_value": 6.666666, + "value": 0 }, "cell:0x3": { "name": "(0,1)", - "double_value": "13.333333", - "value": "0" + "double_value": 13.333333, + "value": 0 }, "cell:0x4": { "name": "(0,2)", - "double_value": "20.000000", - "value": "0" + "double_value": 20.0, + "value": 0 } }, "row:0x11": { "cell:0x12": { "name": "(4,0)", - "double_value": "86.666667", - "value": "0" + "double_value": 86.666666, + "value": 0 }, "cell:0x13": { "name": "(4,1)", - "double_value": "93.333333", - "value": "4" + "double_value": 93.333333, + "value": 4 }, "cell:0x14": { "name": "(4,2)", - "double_value": "100.000000", - "value": "8" + "double_value": 100.0, + "value": 8 } }, "row:0x5": { "cell:0x6": { "name": "(1,0)", - "double_value": "26.666667", - "value": "0" + "double_value": 26.666666, + "value": 0 }, "cell:0x7": { "name": "(1,1)", - "double_value": "33.333333", - "value": "1" + "double_value": 33.333333, + "value": 1 }, "cell:0x8": { "name": "(1,2)", - "double_value": "40.000000", - "value": "2" + "double_value": 40.0, + "value": 2 } }, "row:0x9": { "cell:0xa": { "name": "(2,0)", - "double_value": "46.666667", - "value": "0" + "double_value": 46.666666, + "value": 0 }, "cell:0xb": { "name": "(2,1)", - "double_value": "53.333333", - "value": "2" + "double_value": 53.333333, + "value": 2 }, "cell:0xc": { "name": "(2,2)", - "double_value": "60.000000", - "value": "4" + "double_value": 60.0, + "value": 4 } }, "row:0xd": { "cell:0x10": { "name": "(3,2)", - "double_value": "80.000000", - "value": "6" + "double_value": 80.0, + "value": 6 }, "cell:0xe": { "name": "(3,0)", - "double_value": "66.666667", - "value": "0" + "double_value": 66.666666, + "value": 0 }, "cell:0xf": { "name": "(3,1)", - "double_value": "73.333333", - "value": "3" + "double_value": 73.333333, + "value": 3 } } } diff --git a/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-json.txt b/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-json.txt index d731fc13949d17b0eac8bdb9ace667a739f5db80..c42187cb4f31f18aec358de810ae12ca58b75ba1 100644 --- a/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-json.txt +++ b/garnet/bin/iquery/testing/goldens/vmo-cat-recursive-json.txt @@ -5,282 +5,280 @@ iquery --recursive --format=json --sort objects/root.inspect "contents": { "root": { "array:0x15": [ - "1", - "10", - "-3" + 1, + 10, + -3 ], "array:0x16": [ - "1", - "10", - "2" + 1, + 10, + 2 ], "array:0x17": [ - "0.250000", - "1.250000", - "-0.750000" + 0.25, + 1.25, + -0.75 ], "histogram:0x18": { "buckets": [ { - "floor": "-9223372036854775808", - "upper_bound": "-10", - "count": "10" + "floor": -9223372036854775808, + "upper_bound": -10, + "count": 10 }, { - "floor": "-10", - "upper_bound": "-5", - "count": "5" + "floor": -10, + "upper_bound": -5, + "count": 5 }, { - "floor": "-5", - "upper_bound": "0", - "count": "5" + "floor": -5, + "upper_bound": 0, + "count": 5 }, { - "floor": "0", - "upper_bound": "5", - "count": "5" + "floor": 0, + "upper_bound": 5, + "count": 5 }, { - "floor": "5", - "upper_bound": "9223372036854775807", - "count": "15" + "floor": 5, + "upper_bound": 9223372036854775807, + "count": 15 } ] }, "histogram:0x19": { "buckets": [ { - "floor": "0", - "upper_bound": "5", - "count": "5" + "floor": 0, + "upper_bound": 5, + "count": 5 }, { - "floor": "5", - "upper_bound": "10", - "count": "5" + "floor": 5, + "upper_bound": 10, + "count": 5 }, { - "floor": "10", - "upper_bound": "15", - "count": "5" + "floor": 10, + "upper_bound": 15, + "count": 5 }, { - "floor": "15", - "upper_bound": "20", - "count": "5" + "floor": 15, + "upper_bound": 20, + "count": 5 }, { - "floor": "20", - "upper_bound": "18446744073709551615", - "count": "20" + "floor": 20, + "upper_bound": 18446744073709551615, + "count": 20 } ] }, "histogram:0x1a": { "buckets": [ { - "floor": "-inf", - "upper_bound": "0.000000", - "count": "11.000000" + "floor": "-Infinity", + "upper_bound": 0.0, + "count": 11.0 }, { - "floor": "0.000000", - "upper_bound": "0.500000", - "count": "5.000000" + "floor": 0.0, + "upper_bound": 0.5, + "count": 5.0 }, { - "floor": "0.500000", - "upper_bound": "1.000000", - "count": "5.000000" + "floor": 0.5, + "upper_bound": 1.0, + "count": 5.0 }, { - "floor": "1.000000", - "upper_bound": "1.500000", - "count": "4.000000" + "floor": 1.0, + "upper_bound": 1.5, + "count": 4.0 }, { - "floor": "1.500000", - "upper_bound": "inf", - "count": "15.000000" + "floor": 1.5, + "upper_bound": "Infinity", + "count": 15.0 } ] }, "histogram:0x1b": { "buckets": [ { - "floor": "-9223372036854775808", - "upper_bound": "-10", - "count": "10" + "floor": -9223372036854775808, + "upper_bound": -10, + "count": 10 }, { - "floor": "-10", - "upper_bound": "-5", - "count": "5" + "floor": -10, + "upper_bound": -5, + "count": 5 }, { - "floor": "-5", - "upper_bound": "5", - "count": "10" + "floor": -5, + "upper_bound": 5, + "count": 10 }, { - "floor": "5", - "upper_bound": "25", - "count": "15" + "floor": 5, + "upper_bound": 25, + "count": 15 }, { - "floor": "25", - "upper_bound": "9223372036854775807", - "count": "0" + "floor": 25, + "upper_bound": 9223372036854775807, + "count": 0 } ] }, "histogram:0x1c": { "buckets": [ { - "floor": "0", - "upper_bound": "1", - "count": "1" + "floor": 0, + "upper_bound": 1, + "count": 1 }, { - "floor": "1", - "upper_bound": "2", - "count": "1" + "floor": 1, + "upper_bound": 2, + "count": 1 }, { - "floor": "2", - "upper_bound": "4", - "count": "2" + "floor": 2, + "upper_bound": 4, + "count": 2 }, { - "floor": "4", - "upper_bound": "8", - "count": "4" + "floor": 4, + "upper_bound": 8, + "count": 4 }, { - "floor": "8", - "upper_bound": "18446744073709551615", - "count": "32" + "floor": 8, + "upper_bound": 18446744073709551615, + "count": 32 } ] }, "histogram:0x1d": { "buckets": [ { - "floor": "-inf", - "upper_bound": "0.000000", - "count": "11.000000" + "floor": "-Infinity", + "upper_bound": 0.0, + "count": 11.0 }, { - "floor": "0.000000", - "upper_bound": "1.250000", - "count": "12.000000" + "floor": 0.0, + "upper_bound": 1.25, + "count": 12.0 }, { - "floor": "1.250000", - "upper_bound": "5.000000", - "count": "17.000000" + "floor": 1.25, + "upper_bound": 5.0, + "count": 17.0 }, { - "floor": "5.000000", - "upper_bound": "16.250000", - "count": "0.000000" + "floor": 5.0, + "upper_bound": 16.25, + "count": 0.0 }, { - "floor": "16.250000", - "upper_bound": "inf", - "count": "0.000000" + "floor": 16.25, + "upper_bound": "Infinity", + "count": 0.0 } ] }, "table:0x0": { - "b64:BQEC": "b64:AQI=", - "b64:BQED": "The key of this value is a binary value.", "binary_data": "b64:IAAREgU=", "object_name": "Example Table", "row:0x1": { "cell:0x2": { "name": "(0,0)", - "double_value": "6.666667", - "value": "0" + "double_value": 6.666666, + "value": 0 }, "cell:0x3": { "name": "(0,1)", - "double_value": "13.333333", - "value": "0" + "double_value": 13.333333, + "value": 0 }, "cell:0x4": { "name": "(0,2)", - "double_value": "20.000000", - "value": "0" + "double_value": 20.0, + "value": 0 } }, "row:0x11": { "cell:0x12": { "name": "(4,0)", - "double_value": "86.666667", - "value": "0" + "double_value": 86.666666, + "value": 0 }, "cell:0x13": { "name": "(4,1)", - "double_value": "93.333333", - "value": "4" + "double_value": 93.333333, + "value": 4 }, "cell:0x14": { "name": "(4,2)", - "double_value": "100.000000", - "value": "8" + "double_value": 100.0, + "value": 8 } }, "row:0x5": { "cell:0x6": { "name": "(1,0)", - "double_value": "26.666667", - "value": "0" + "double_value": 26.666666, + "value": 0 }, "cell:0x7": { "name": "(1,1)", - "double_value": "33.333333", - "value": "1" + "double_value": 33.333333, + "value": 1 }, "cell:0x8": { "name": "(1,2)", - "double_value": "40.000000", - "value": "2" + "double_value": 40.0, + "value": 2 } }, "row:0x9": { "cell:0xa": { "name": "(2,0)", - "double_value": "46.666667", - "value": "0" + "double_value": 46.666666, + "value": 0 }, "cell:0xb": { "name": "(2,1)", - "double_value": "53.333333", - "value": "2" + "double_value": 53.333333, + "value": 2 }, "cell:0xc": { "name": "(2,2)", - "double_value": "60.000000", - "value": "4" + "double_value": 60.0, + "value": 4 } }, "row:0xd": { "cell:0x10": { "name": "(3,2)", - "double_value": "80.000000", - "value": "6" + "double_value": 80.0, + "value": 6 }, "cell:0xe": { "name": "(3,0)", - "double_value": "66.666667", - "value": "0" + "double_value": 66.666666, + "value": 0 }, "cell:0xf": { "name": "(3,1)", - "double_value": "73.333333", - "value": "3" + "double_value": 73.333333, + "value": 3 } } } diff --git a/garnet/bin/iquery/testing/goldens/vmo-cat-recursive.txt b/garnet/bin/iquery/testing/goldens/vmo-cat-recursive.txt index 1b84b456b4bebb140a8f6bca1c60f63adea81a6d..29fda0fa4858ee90d55a51f6ca7e2fcf797d26ee 100644 --- a/garnet/bin/iquery/testing/goldens/vmo-cat-recursive.txt +++ b/garnet/bin/iquery/testing/goldens/vmo-cat-recursive.txt @@ -3,18 +3,13 @@ root: array:0x15 = [1, 10, -3] array:0x16 = [1, 10, 2] array:0x17 = [0.250000, 1.250000, -0.750000] - histogram:0x18 = [<min>=10, -10=5, -5=5, 0=5, 5=15] - histogram:0x19 = [0=5, 5=5, 10=5, 15=5, 20=20] - histogram:0x1a = [-inf=11, 0.000000=5, 0.500000=5, 1.000000=4, 1.500000=15] - histogram:0x1b = [<min>=10, -10=5, -5=10, 5=15, 25=0] - histogram:0x1c = [0=1, 1=1, 2=2, 4=4, 8=32] - histogram:0x1d = [-inf=11, 0.000000=12, 1.250000=17, 5.000000=0, 16.250000=0] + histogram:0x18 = [[<min>,-10)=10, [-10,-5)=5, [-5,0)=5, [0,5)=5, [5,<max>)=15] + histogram:0x19 = [[0,5)=5, [5,10)=5, [10,15)=5, [15,20)=5, [20,<max>)=20] + histogram:0x1a = [[-inf,0.000000)=11, [0.000000,0.500000)=5, [0.500000,1.000000)=5, [1.000000,1.500000)=4, [1.500000,inf)=15] + histogram:0x1b = [[<min>,-10)=10, [-10,-5)=5, [-5,5)=10, [5,25)=15, [25,<max>)=0] + histogram:0x1c = [[0,1)=1, [1,2)=1, [2,4)=2, [4,8)=4, [8,<max>)=32] + histogram:0x1d = [[-inf,0.000000)=11, [0.000000,1.250000)=12, [1.250000,5.000000)=17, [5.000000,16.250000)=0, [16.250000,inf)=0] table:0x0: - Binary: -0000 05 01 02 ... = Binary: -0000 01 02 .. - Binary: -0000 05 01 03 ... = The key of this value is a binary value. binary_data = Binary: 0000 20 00 11 12 05 .... object_name = Example Table diff --git a/garnet/bin/iquery/testing/goldens/vmo-cat-single-absolute.txt b/garnet/bin/iquery/testing/goldens/vmo-cat-single-absolute.txt index 2061c5fb07bee6a82afa76b6df25735451dd33f6..dcb488314df953e479f061c4f99fc704e771f511 100644 --- a/garnet/bin/iquery/testing/goldens/vmo-cat-single-absolute.txt +++ b/garnet/bin/iquery/testing/goldens/vmo-cat-single-absolute.txt @@ -1,11 +1,6 @@ # Absolute paths gives the full path to each object from the root directory. iquery --absolute_paths --sort objects/root.inspect#table:0x0 /hub/r/test/*/c/iquery_example_component.cmx/*/out/objects/root.inspect#table:0x0: - Binary: -0000 05 01 02 ... = Binary: -0000 01 02 .. - Binary: -0000 05 01 03 ... = The key of this value is a binary value. binary_data = Binary: 0000 20 00 11 12 05 .... object_name = Example Table diff --git a/garnet/bin/iquery/testing/goldens/vmo-cat-single-full.txt b/garnet/bin/iquery/testing/goldens/vmo-cat-single-full.txt index 71fa73dd395f45f948fc53e8259712d9bce5a0c9..f9d1e414190cbd967ccccf519b23545bfa973d24 100644 --- a/garnet/bin/iquery/testing/goldens/vmo-cat-single-full.txt +++ b/garnet/bin/iquery/testing/goldens/vmo-cat-single-full.txt @@ -1,11 +1,6 @@ # Full paths lists the relative path to the object listed. iquery --full_paths --sort objects/root.inspect#table:0x0 objects/root.inspect#table:0x0: - Binary: -0000 05 01 02 ... = Binary: -0000 01 02 .. - Binary: -0000 05 01 03 ... = The key of this value is a binary value. binary_data = Binary: 0000 20 00 11 12 05 .... object_name = Example Table diff --git a/garnet/bin/iquery/testing/goldens/vmo-cat-single.txt b/garnet/bin/iquery/testing/goldens/vmo-cat-single.txt index bb5c51042d93d3a1d36d4475a9aa2657475a0b92..8b3299bb2f24ba0d0e46d23aae959f03ad3bccc3 100644 --- a/garnet/bin/iquery/testing/goldens/vmo-cat-single.txt +++ b/garnet/bin/iquery/testing/goldens/vmo-cat-single.txt @@ -1,11 +1,6 @@ # Output the object properties for one object in text format. iquery --sort objects/root.inspect#table:0x0 table:0x0: - Binary: -0000 05 01 02 ... = Binary: -0000 01 02 .. - Binary: -0000 05 01 03 ... = The key of this value is a binary value. binary_data = Binary: 0000 20 00 11 12 05 .... object_name = Example Table diff --git a/garnet/bin/iquery/utils.cc b/garnet/bin/iquery/utils.cc deleted file mode 100644 index 95979fe0392d343d26468f0e4bb49bfb04e57fed..0000000000000000000000000000000000000000 --- a/garnet/bin/iquery/utils.cc +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "garnet/bin/iquery/utils.h" - -#include <inttypes.h> -#include <lib/fostr/hex_dump.h> -#include <src/lib/fxl/strings/concatenate.h> -#include <src/lib/fxl/strings/string_printf.h> -#include <src/lib/fxl/strings/utf_codecs.h> -#include <third_party/cobalt/util/crypto_util/base64.h> - -#include <iostream> - -#include "garnet/bin/iquery/options.h" -#include "lib/inspect/hierarchy.h" -#include "src/lib/files/path.h" - -using cobalt::crypto::Base64Encode; -using inspect::hierarchy::DoubleMetric; -using inspect::hierarchy::IntMetric; -using inspect::hierarchy::Metric; -using inspect::hierarchy::UIntMetric; - -namespace iquery { - -namespace { - -constexpr size_t kMaxHexSize = 256; -std::string HexDump(fxl::StringView contents) { - std::ostringstream out; - if (contents.size() > kMaxHexSize) { - out << "\nFirst " << kMaxHexSize << " bytes of " << contents.size(); - } - out << fostr::HexDump(contents.data(), std::min(kMaxHexSize, contents.size()), - 0x0); - return out.str(); -} - -} // namespace - -// TODO(donosoc): Cleanup artifacts like "//" or ending in '/' -std::string FormatPath(Options::PathFormatting path_format, - const std::string& path, const std::string& name) { - switch (path_format) { - case Options::PathFormatting::NONE: - return name; - case Options::PathFormatting::FULL: - return path; - case Options::PathFormatting::ABSOLUTE: - return files::AbsolutePath(path); - } -}; - -std::string FormatStringHexFallback(fxl::StringView val) { - if (IsStringPrintable(val)) { - return std::string(val.begin(), val.end()); - } else { - return fxl::StringPrintf("Binary: %s", HexDump(val).c_str()); - } -} - -std::string FormatStringBase64Fallback(fxl::StringView val) { - if (IsStringPrintable(val)) { - return std::string(val.begin(), val.end()); - } else { - std::string content; - Base64Encode((uint8_t*)val.data(), val.size(), &content); - return fxl::Concatenate({"b64:", content}); - } -} - -template <> -std::string FormatNumericValue(int64_t value) { - return fxl::StringPrintf("%" PRId64, value); -} - -template <> -std::string FormatNumericValue(uint64_t value) { - return fxl::StringPrintf("%" PRIu64, value); -} - -template <> -std::string FormatNumericValue(double value) { - return fxl::StringPrintf("%.6f", value); -} - -std::string FormatNumericMetricValue(const Metric& metric) { - switch (metric.format()) { - case inspect::hierarchy::MetricFormat::INT: - return FormatNumericValue(metric.Get<IntMetric>().value()); - case inspect::hierarchy::MetricFormat::UINT: - return FormatNumericValue(metric.Get<UIntMetric>().value()); - case inspect::hierarchy::MetricFormat::DOUBLE: - return FormatNumericValue(metric.Get<DoubleMetric>().value()); - default: - FXL_LOG(WARNING) << "Unknown metric type"; - return ""; - } -} - -bool IsStringPrintable(fxl::StringView input) { - if (!fxl::IsStringUTF8(input)) { - return false; - } - - // Ensure the string does not contain unprintable ASCII characters. - uint32_t code_point; - for (size_t index = 0; fxl::ReadUnicodeCharacter(input.data(), input.size(), - &index, &code_point) && - index != input.size(); - index++) { - // Skip any non-ASCII code points. - if (code_point & (~0x7F)) { - continue; - } - if (isprint(code_point) || code_point == '\t' || code_point == '\n' || - code_point == '\r') { - continue; - } - return false; - } - return true; -} - -} // namespace iquery diff --git a/garnet/bin/iquery/utils.h b/garnet/bin/iquery/utils.h deleted file mode 100644 index 27da5bdb8b5d44aa634cf8df4306be96fc0697a2..0000000000000000000000000000000000000000 --- a/garnet/bin/iquery/utils.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef GARNET_BIN_IQUERY_UTILS_H_ -#define GARNET_BIN_IQUERY_UTILS_H_ - -#include <lib/inspect/hierarchy.h> -#include <src/lib/fxl/macros.h> - -#include <string> - -#include "garnet/bin/iquery/options.h" - -// Utility functions that are transversal to modes. - -namespace iquery { - -// If option is none, will return the provided name, -// full_paths return the given path and absolute will create the absolute path. -std::string FormatPath(Options::PathFormatting, const std::string& path, - const std::string& name = ""); - -// Format a string handling the case where the string is not a valid UTF8 -// string by outputting a hex dump. -std::string FormatStringHexFallback(fxl::StringView val); - -// Format a string handling the case where the string is not a valid UTF8 -// string by outputting the string encoded in Base64. -std::string FormatStringBase64Fallback(fxl::StringView val); - -// Format a numeric type as a string. -template <typename T> -std::string FormatNumericValue(T value); - -// Metric values have a lot of representations (int, uint, etc.). -// This functions returns a string representing the correct value. -std::string FormatNumericMetricValue(const inspect::hierarchy::Metric& metric); - -bool IsStringPrintable(fxl::StringView input); - -template <> -std::string FormatNumericValue(int64_t value); - -template <> -std::string FormatNumericValue(uint64_t value); - -template <> -std::string FormatNumericValue(double value); - -} // namespace iquery - -#endif // GARNET_BIN_IQUERY_UTILS_H_ diff --git a/garnet/bin/iquery/utils_test.cc b/garnet/bin/iquery/utils_test.cc deleted file mode 100644 index 23ebecb9ced91a85d45cdfd86094a44e85ada280..0000000000000000000000000000000000000000 --- a/garnet/bin/iquery/utils_test.cc +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "garnet/bin/iquery/utils.h" - -#include "gtest/gtest.h" - -namespace { - -TEST(IqueryUtils, IsStringPrintable) { - EXPECT_TRUE(iquery::IsStringPrintable("hello")); - EXPECT_TRUE(iquery::IsStringPrintable("hello world")); - EXPECT_TRUE(iquery::IsStringPrintable("hello\tworld")); - EXPECT_TRUE(iquery::IsStringPrintable("hello\nworld\r\nagain")); - // <smiling face> :-) <filled black star>. - // \x05 is not printable ASCII, so this checks that we properly increment the - // index. - EXPECT_TRUE(iquery::IsStringPrintable("\u263A :-) \u2605")); - EXPECT_FALSE(iquery::IsStringPrintable("hello\x6")); - EXPECT_FALSE(iquery::IsStringPrintable("hello\x80")); - EXPECT_FALSE(iquery::IsStringPrintable(std::string("hello\0", 6))); -} - -} // namespace diff --git a/garnet/packages/tests/BUILD.gn b/garnet/packages/tests/BUILD.gn index d24b12cc63f562fac30e8239312b945b9da2f22a..9c389e3d2ec12b571c6dcec52445bb3fda0351ed 100644 --- a/garnet/packages/tests/BUILD.gn +++ b/garnet/packages/tests/BUILD.gn @@ -359,7 +359,6 @@ group("all") { "//garnet/packages/tests:inspect_query_unittests", "//garnet/packages/tests:inspect_unittests", "//garnet/packages/tests:iquery_golden_test", - "//garnet/packages/tests:iquery_test", "//garnet/packages/tests:json", "//garnet/packages/tests:kms", "//garnet/packages/tests:lib", @@ -1010,13 +1009,6 @@ group("go_tuf") { ] } -group("iquery_test") { - testonly = true - public_deps = [ - "//garnet/bin/iquery:iquery_test", - ] -} - group("libinspect_integration_tests") { testonly = true public_deps = [ diff --git a/garnet/public/lib/inspect/query/text_formatter.cc b/garnet/public/lib/inspect/query/text_formatter.cc index 6e17a2d8b4a9eb4a6482ed5f24d0afd3641f83ed..fb68eaa09686ecf8d5f3468ce7a13f9c7e039f27 100644 --- a/garnet/public/lib/inspect/query/text_formatter.cc +++ b/garnet/public/lib/inspect/query/text_formatter.cc @@ -41,15 +41,15 @@ void FormatArray(std::ostream& ss, const ArrayType& array) { // bucket. Replace them with "<min>" if (bucket.floor != 0 && bucket.floor == std::numeric_limits<decltype(bucket.floor)>::min()) { - ss << "[<min>," << bucket.upper_limit << "]="; + ss << "[<min>," << bucket.upper_limit << ")="; } else if (bucket.upper_limit != 0 && bucket.upper_limit == std::numeric_limits<decltype(bucket.upper_limit)>::max()) { - ss << "[" << bucket.floor << ",<max>]="; + ss << "[" << bucket.floor << ",<max>)="; } else { - ss << "[" << bucket.floor << "," << bucket.upper_limit << "]="; + ss << "[" << bucket.floor << "," << bucket.upper_limit << ")="; } // Cast all counts to integers for display.