Commit 00efb85b authored by Daniel Bevenius's avatar Daniel Bevenius Committed by Commit Bot

[cctest] use HelpOptions to print usage

The commit updates the way the usage is printed for cctest to make use
of HelpOptions which allows the usage string to be passed into
SetFlagsFromCommandLine function.

Change-Id: I8dcd48ca8bb7b025f77c0f05ab37ce4f7b6fae04
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2402032Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69839}
parent 9c72b62a
......@@ -25,14 +25,15 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "include/v8.h"
#include "test/cctest/cctest.h"
#include "include/libplatform/libplatform.h"
#include "include/v8.h"
#include "src/codegen/compiler.h"
#include "src/codegen/optimized-compilation-info.h"
#include "src/compiler/pipeline.h"
#include "src/debug/debug.h"
#include "src/flags/flags.h"
#include "src/objects/objects-inl.h"
#include "src/trap-handler/trap-handler.h"
#include "test/cctest/print-extension.h"
......@@ -306,19 +307,11 @@ int main(int argc, char* argv[]) {
#endif // V8_CC_MSVC
#endif // V8_OS_WIN
// hack to print cctest specific flags
for (int i = 1; i < argc; i++) {
char* arg = argv[i];
if ((strcmp(arg, "--help") == 0) || (strcmp(arg, "-h") == 0)) {
printf("Usage: %s [--list] [[V8_FLAGS] CCTEST]\n", argv[0]);
printf("\n");
printf("Options:\n");
printf(" --list: list all cctests\n");
printf(" CCTEST: cctest identfier returned by --list\n");
printf(" D8_FLAGS: see d8 output below\n");
printf("\n\n");
}
}
std::string usage = "Usage: " + std::string(argv[0]) + " [--list]" +
" [[V8_FLAGS] CCTEST]\n\n" + "Options:\n" +
" --list: list all cctests\n" +
" CCTEST: cctest identfier returned by --list\n" +
" V8_FLAGS: see V8 options below\n\n\n";
#ifdef V8_USE_PERFETTO
// Set up the in-process backend that the tracing controller will connect to.
......@@ -330,7 +323,9 @@ int main(int argc, char* argv[]) {
v8::V8::InitializeICUDefaultLocation(argv[0]);
std::unique_ptr<v8::Platform> platform(v8::platform::NewDefaultPlatform());
v8::V8::InitializePlatform(platform.get());
v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
using HelpOptions = v8::internal::FlagList::HelpOptions;
v8::internal::FlagList::SetFlagsFromCommandLine(
&argc, argv, true, HelpOptions(HelpOptions::kExit, usage.c_str()));
v8::V8::Initialize();
v8::V8::InitializeExternalStartupData(argv[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment