def graph(parser, args): concretize = not args.normalize if args.installed: if args.specs: tty.die("Can't specify specs with --installed") args.dot = True specs = spack.store.db.query() else: specs = spack.cmd.parse_specs(args.specs, normalize=True, concretize=concretize) if not specs: setup_parser.parser.print_help() return 1 deptype = all_deptypes if args.deptype: deptype = tuple(args.deptype.split(',')) if deptype == ('all', ): deptype = 'all' deptype = canonical_deptype(deptype) if args.dot: # Dot graph only if asked for. graph_dot(specs, static=args.static, deptype=deptype) elif specs: # ascii is default: user doesn't need to provide it explicitly graph_ascii(specs[0], debug=spack.debug, deptype=deptype) for spec in specs[1:]: print() # extra line bt/w independent graphs graph_ascii(spec, debug=spack.debug)
def test_dynamic_dot_graph_mpileaks(mock_packages, config): """Test dynamically graphing the mpileaks package.""" s = Spec('mpileaks').concretized() stream = StringIO() graph_dot([s], static=False, out=stream) dot = stream.getvalue() print(dot) mpileaks_hash, mpileaks_lbl = s.dag_hash(), s.format('{name}') mpi_hash, mpi_lbl = s['mpi'].dag_hash(), s['mpi'].format('{name}') callpath_hash, callpath_lbl = (s['callpath'].dag_hash(), s['callpath'].format('{name}')) dyninst_hash, dyninst_lbl = (s['dyninst'].dag_hash(), s['dyninst'].format('{name}')) libdwarf_hash, libdwarf_lbl = (s['libdwarf'].dag_hash(), s['libdwarf'].format('{name}')) libelf_hash, libelf_lbl = (s['libelf'].dag_hash(), s['libelf'].format('{name}')) assert ' "%s" [label="%s"]\n' % (mpileaks_hash, mpileaks_lbl) in dot assert ' "%s" [label="%s"]\n' % (callpath_hash, callpath_lbl) in dot assert ' "%s" [label="%s"]\n' % (mpi_hash, mpi_lbl) in dot assert ' "%s" [label="%s"]\n' % (dyninst_hash, dyninst_lbl) in dot assert ' "%s" [label="%s"]\n' % (libdwarf_hash, libdwarf_lbl) in dot assert ' "%s" [label="%s"]\n' % (libelf_hash, libelf_lbl) in dot assert ' "%s" -> "%s"\n' % (dyninst_hash, libdwarf_hash) in dot assert ' "%s" -> "%s"\n' % (callpath_hash, dyninst_hash) in dot assert ' "%s" -> "%s"\n' % (mpileaks_hash, mpi_hash) in dot assert ' "%s" -> "%s"\n' % (libdwarf_hash, libelf_hash) in dot assert ' "%s" -> "%s"\n' % (callpath_hash, mpi_hash) in dot assert ' "%s" -> "%s"\n' % (mpileaks_hash, callpath_hash) in dot assert ' "%s" -> "%s"\n' % (dyninst_hash, libelf_hash) in dot
def test_dynamic_dot_graph_mpileaks(mock_packages): """Test dynamically graphing the mpileaks package.""" s = Spec('mpileaks').normalized() stream = StringIO() graph_dot([s], static=False, out=stream) dot = stream.getvalue() mpileaks_hash, mpileaks_lbl = s.dag_hash(), s.format('$_$/') mpi_hash, mpi_lbl = s['mpi'].dag_hash(), s['mpi'].format('$_$/') callpath_hash, callpath_lbl = ( s['callpath'].dag_hash(), s['callpath'].format('$_$/')) dyninst_hash, dyninst_lbl = ( s['dyninst'].dag_hash(), s['dyninst'].format('$_$/')) libdwarf_hash, libdwarf_lbl = ( s['libdwarf'].dag_hash(), s['libdwarf'].format('$_$/')) libelf_hash, libelf_lbl = ( s['libelf'].dag_hash(), s['libelf'].format('$_$/')) assert ' "%s" [label="%s"]\n' % (mpileaks_hash, mpileaks_lbl) in dot assert ' "%s" [label="%s"]\n' % (callpath_hash, callpath_lbl) in dot assert ' "%s" [label="%s"]\n' % (mpi_hash, mpi_lbl) in dot assert ' "%s" [label="%s"]\n' % (dyninst_hash, dyninst_lbl) in dot assert ' "%s" [label="%s"]\n' % (libdwarf_hash, libdwarf_lbl) in dot assert ' "%s" [label="%s"]\n' % (libelf_hash, libelf_lbl) in dot assert ' "%s" -> "%s"\n' % (dyninst_hash, libdwarf_hash) in dot assert ' "%s" -> "%s"\n' % (callpath_hash, dyninst_hash) in dot assert ' "%s" -> "%s"\n' % (mpileaks_hash, mpi_hash) in dot assert ' "%s" -> "%s"\n' % (libdwarf_hash, libelf_hash) in dot assert ' "%s" -> "%s"\n' % (callpath_hash, mpi_hash) in dot assert ' "%s" -> "%s"\n' % (mpileaks_hash, callpath_hash) in dot assert ' "%s" -> "%s"\n' % (dyninst_hash, libelf_hash) in dot
def test_static_graph_mpileaks(mock_packages): """Test a static spack graph for a simple package.""" s = Spec('mpileaks').normalized() stream = StringIO() graph_dot([s], static=True, out=stream) dot = stream.getvalue() assert ' "mpileaks" [label="mpileaks"]\n' in dot assert ' "dyninst" [label="dyninst"]\n' in dot assert ' "callpath" [label="callpath"]\n' in dot assert ' "libelf" [label="libelf"]\n' in dot assert ' "libdwarf" [label="libdwarf"]\n' in dot mpi_providers = spack.repo.path.providers_for('mpi') for spec in mpi_providers: assert ('"mpileaks" -> "%s"' % spec.name) in dot assert ('"callpath" -> "%s"' % spec.name) in dot assert ' "dyninst" -> "libdwarf"\n' in dot assert ' "callpath" -> "dyninst"\n' in dot assert ' "libdwarf" -> "libelf"\n' in dot assert ' "mpileaks" -> "callpath"\n' in dot assert ' "dyninst" -> "libelf"\n' in dot
def graph(parser, args): if args.installed: if args.specs: tty.die("Can't specify specs with --installed") args.dot = True specs = spack.store.db.query() else: specs = spack.cmd.parse_specs(args.specs, concretize=not args.static) if not specs: setup_parser.parser.print_help() return 1 if args.static: args.dot = True if args.dot: graph_dot(specs, static=args.static, deptype=args.deptype) elif specs: # ascii is default: user doesn't need to provide it explicitly debug = spack.config.get('config:debug') graph_ascii(specs[0], debug=debug, deptype=args.deptype) for spec in specs[1:]: print() # extra line bt/w independent graphs graph_ascii(spec, debug=debug)
def graph(parser, args): concretize = not args.normalize if args.installed: if args.specs: tty.die("Can't specify specs with --installed") args.dot = True specs = spack.store.db.query() else: specs = spack.cmd.parse_specs( args.specs, normalize=True, concretize=concretize) if not specs: setup_parser.parser.print_help() return 1 deptype = all_deptypes if args.deptype: deptype = tuple(args.deptype.split(',')) if deptype == ('all',): deptype = 'all' deptype = canonical_deptype(deptype) if args.dot: # Dot graph only if asked for. graph_dot(specs, static=args.static, deptype=deptype) elif specs: # ascii is default: user doesn't need to provide it explicitly debug = spack.config.get('config:debug') graph_ascii(specs[0], debug=debug, deptype=deptype) for spec in specs[1:]: print() # extra line bt/w independent graphs graph_ascii(spec, debug=debug)
def test_static_graph_mpileaks(mock_packages): """Test a static spack graph for a simple package.""" s = Spec('mpileaks').normalized() stream = StringIO() graph_dot([s], static=True, out=stream) dot = stream.getvalue() assert ' "mpileaks" [label="mpileaks"]\n' in dot assert ' "dyninst" [label="dyninst"]\n' in dot assert ' "callpath" [label="callpath"]\n' in dot assert ' "libelf" [label="libelf"]\n' in dot assert ' "libdwarf" [label="libdwarf"]\n' in dot assert ' "dyninst" -> "libdwarf"\n' in dot assert ' "callpath" -> "dyninst"\n' in dot assert ' "mpileaks" -> "mpi"\n' in dot assert ' "libdwarf" -> "libelf"\n' in dot assert ' "callpath" -> "mpi"\n' in dot assert ' "mpileaks" -> "callpath"\n' in dot assert ' "dyninst" -> "libelf"\n' in dot
def test_static_graph_mpileaks(builtin_mock): """Test a static spack graph for a simple package.""" s = Spec('mpileaks').normalized() stream = StringIO() graph_dot([s], static=True, out=stream) dot = stream.getvalue() assert ' "mpileaks" [label="mpileaks"]\n' in dot assert ' "dyninst" [label="dyninst"]\n' in dot assert ' "callpath" [label="callpath"]\n' in dot assert ' "libelf" [label="libelf"]\n' in dot assert ' "libdwarf" [label="libdwarf"]\n' in dot assert ' "dyninst" -> "libdwarf"\n' in dot assert ' "callpath" -> "dyninst"\n' in dot assert ' "mpileaks" -> "mpi"\n' in dot assert ' "libdwarf" -> "libelf"\n' in dot assert ' "callpath" -> "mpi"\n' in dot assert ' "mpileaks" -> "callpath"\n' in dot assert ' "dyninst" -> "libelf"\n' in dot