import logging

sys.path.append("..")
import Objects
import make_differential_dfxml

_logger = logging.getLogger(os.path.basename(__file__))

if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO)

    thisdir = os.path.dirname(__file__)
    tempxml1_path = __file__ + "-test1.xml"
    tempxml2_path = __file__ + "-test2.xml"
    d_in_memory = make_differential_dfxml.make_differential_dfxml(
      os.path.join(thisdir, "../../samples/difference_test_2.xml"),
      os.path.join(thisdir, "../../samples/difference_test_3.xml")
    )

    #Write and read the DFXML stream a couple times to ensure consistent serialization and deserialization
    with open(tempxml1_path, "w") as fh:
        d_in_memory.print_dfxml(output_fh=fh)
    d_from_disk = Objects.parse(tempxml1_path)
    with open(tempxml2_path, "w") as fh:
        d_from_disk.print_dfxml(output_fh=fh)
    d_from_disk_again = Objects.parse(tempxml2_path)

    for d in (d_in_memory, d_from_disk, d_from_disk_again):
        for o in d:
            _logger.debug(repr(o))
            if isinstance(o, Objects.VolumeObject):
                expected_partition_annos = {
示例#2
0
    if args.imagefile:
        raise NotImplementedError("Sorry, but the imagefile argument was not carried forward in the re-implementation.  Please feel free to request this feature be re-implemented if you need it.")

    pre = None
    post = None
    for infile in args.infiles:
        pre = post
        post = infile

        _logger.info(">>> Reading %s." % infile)

        if not pre is None:
            diffdfxml = make_differential_dfxml.make_differential_dfxml(
              pre,
              post,
              diff_mode="idifference",
              ignore_filename_function=ignorable_name
            )
            diffdfxml.program = sys.argv[0]
            diffdfxml.program_version = __version__
            if args.xmlfilename:
                _logger.debug("Opening temp file for writing.")
                with open(args.xmlfilename, "w") as fh:
                    diffdfxml.print_dfxml(output_fh=fh)
            summarize_differential_dfxml.report(
              diffdfxml,
              sort_by=args.sort_by,
              summary=args.summary,
              timestamp=args.timestamp
            )
    if args.imagefile:
        raise NotImplementedError("Sorry, but the imagefile argument was not carried forward in the re-implementation.  Please feel free to request this feature be re-implemented if you need it.")

    pre = None
    post = None
    for infile in args.infiles:
        pre = post
        post = infile

        _logger.info(">>> Reading %s." % infile)

        if not pre is None:
            diffdfxml = make_differential_dfxml.make_differential_dfxml(
              pre,
              post,
              diff_mode="idifference",
              ignore_filename_function=ignorable_name
            )
            diffdfxml.program = sys.argv[0]
            diffdfxml.program_version = __version__
            if args.xmlfilename:
                _logger.debug("Opening temp file for writing.")
                with open(args.xmlfilename, "w") as fh:
                    diffdfxml.print_dfxml(output_fh=fh)
            summarize_differential_dfxml.report(
              diffdfxml,
              sort_by=args.sort_by,
              summary=args.summary,
              timestamp=args.timestamp
            )
SAMPLES_DIR = os.path.dirname(__file__) + "../../../samples"

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("-d", "--debug", action="store_true")
    args = parser.parse_args()

    logging.basicConfig(level=logging.DEBUG if args.debug else logging.INFO)

    tempxml1_path = __file__ + "-test1.xml"
    tempxml2_path = __file__ + "-test2.xml"

    _logger = logging.getLogger(os.path.basename(__file__))
    _logger.info("Building iteration: 0.")
    d_in_memory = make_differential_dfxml.make_differential_dfxml(
        os.path.join(SAMPLES_DIR, "difference_test_0.xml"),
        os.path.join(SAMPLES_DIR, "difference_test_1.xml"))

    #Write and read the DFXML stream a couple times to ensure consistent serialization and deserialization
    with open(tempxml1_path, "w") as fh:
        d_in_memory.print_dfxml(output_fh=fh)
    _logger.info("Building iteration: 1.")
    d_from_disk = Objects.parse(tempxml1_path)
    with open(tempxml2_path, "w") as fh:
        d_from_disk.print_dfxml(output_fh=fh)
    _logger.info("Building iteration: 2.")
    d_from_disk_again = Objects.parse(tempxml2_path)

    for (iteration, d) in enumerate(
        (d_in_memory, d_from_disk, d_from_disk_again)):
        _logger.info("Checking iteration: %d." % iteration)
SAMPLES_DIR=os.path.dirname(__file__)+"../../../samples"

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("-d", "--debug", action="store_true")
    args = parser.parse_args()

    logging.basicConfig(level=logging.DEBUG if args.debug else logging.INFO)

    tempxml1_path = __file__ + "-test1.xml"
    tempxml2_path = __file__ + "-test2.xml"

    _logger = logging.getLogger(os.path.basename(__file__))
    _logger.info("Building iteration: 0.")
    d_in_memory = make_differential_dfxml.make_differential_dfxml(
      os.path.join(SAMPLES_DIR, "difference_test_0.xml"),
      os.path.join(SAMPLES_DIR, "difference_test_1.xml")
    )

    #Write and read the DFXML stream a couple times to ensure consistent serialization and deserialization
    with open(tempxml1_path, "w") as fh:
        d_in_memory.print_dfxml(output_fh=fh)
    _logger.info("Building iteration: 1.")
    d_from_disk = Objects.parse(tempxml1_path)
    with open(tempxml2_path, "w") as fh:
        d_from_disk.print_dfxml(output_fh=fh)
    _logger.info("Building iteration: 2.")
    d_from_disk_again = Objects.parse(tempxml2_path)

    for (iteration, d) in enumerate((d_in_memory, d_from_disk, d_from_disk_again)):
        _logger.info("Checking iteration: %d." % iteration)
        for o in d:
示例#6
0
sys.path.append(os.path.join(os.path.dirname(__file__), "../.."))
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))

import dfxml.objects as Objects
import make_differential_dfxml

if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO)
    _logger = logging.getLogger(os.path.basename(__file__))

    thisdir = os.path.dirname(__file__)
    tempxml1_path = __file__ + "-test1.xml"
    tempxml2_path = __file__ + "-test2.xml"
    d_in_memory = make_differential_dfxml.make_differential_dfxml(
        os.path.join(thisdir, SAMPLES_DIR + "/difference_test_2.xml"),
        os.path.join(thisdir, SAMPLES_DIR + "/difference_test_3.xml"))

    #Write and read the DFXML stream a couple times to ensure consistent serialization and deserialization
    with open(tempxml1_path, "w") as fh:
        d_in_memory.print_dfxml(output_fh=fh)
    d_from_disk = Objects.parse(tempxml1_path)
    with open(tempxml2_path, "w") as fh:
        d_from_disk.print_dfxml(output_fh=fh)
    d_from_disk_again = Objects.parse(tempxml2_path)

    for d in (d_in_memory, d_from_disk, d_from_disk_again):
        for o in d:
            _logger.debug(repr(o))
            if isinstance(o, Objects.VolumeObject):
                expected_partition_annos = {
示例#7
0
 def dfxml_object(self):
     """Populates on first access.  There is intentionally no setter."""
     if self._dfxml_object is None:
         self._dfxml_object = make_differential_dfxml.make_differential_dfxml(self._pre_path, self._post_path, glom_byte_runs=True)
     return self._dfxml_object
sys.path.append( os.path.join(os.path.dirname(__file__), "../.."))
sys.path.append( os.path.join(os.path.dirname(__file__), ".."))

import dfxml.objects as Objects
import make_differential_dfxml


if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO)
    _logger = logging.getLogger(os.path.basename(__file__))

    thisdir = os.path.dirname(__file__)
    tempxml1_path = __file__ + "-test1.xml"
    tempxml2_path = __file__ + "-test2.xml"
    d_in_memory = make_differential_dfxml.make_differential_dfxml(
      os.path.join(thisdir, SAMPLES_DIR+"/difference_test_2.xml"),
      os.path.join(thisdir, SAMPLES_DIR+"/difference_test_3.xml")
    )

    #Write and read the DFXML stream a couple times to ensure consistent serialization and deserialization
    with open(tempxml1_path, "w") as fh:
        d_in_memory.print_dfxml(output_fh=fh)
    d_from_disk = Objects.parse(tempxml1_path)
    with open(tempxml2_path, "w") as fh:
        d_from_disk.print_dfxml(output_fh=fh)
    d_from_disk_again = Objects.parse(tempxml2_path)

    for d in (d_in_memory, d_from_disk, d_from_disk_again):
        for o in d:
            _logger.debug(repr(o))
            if isinstance(o, Objects.VolumeObject):
                expected_partition_annos = {