xref: /llvm-project/cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexCommandLine.py (revision f98ee40f4b5d7474fc67e82824bf6abbaedb7b1c)
1# DExTer : Debugging Experience Tester
2# ~~~~~~   ~         ~~         ~   ~~
3#
4# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5# See https://llvm.org/LICENSE.txt for license information.
6# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7"""A Command that specifies the command line with which to run the test.
8"""
9
10from dex.command.CommandBase import CommandBase
11
12
13class DexCommandLine(CommandBase):
14    def __init__(self, the_cmdline):
15        if type(the_cmdline) is not list:
16            raise TypeError("Expected list, got {}".format(type(the_cmdline)))
17        for x in the_cmdline:
18            if type(x) is not str:
19                raise TypeError(
20                    'Command line element "{}" has type {}'.format(x, type(x))
21                )
22        self.the_cmdline = the_cmdline
23        super(DexCommandLine, self).__init__()
24
25    def eval(self):
26        raise NotImplementedError("DexCommandLine commands cannot be evaled.")
27
28    @staticmethod
29    def get_name():
30        return __class__.__name__
31
32    @staticmethod
33    def get_subcommands() -> dict:
34        return None
35