From e569ff2752f92dfc7aa510005d3eb2030b3b129b Mon Sep 17 00:00:00 2001 From: Yinan Xu Date: Tue, 29 Nov 2022 19:37:38 +0800 Subject: [PATCH] Add error when use --exe with --lib-create. (#3785) --- docs/CONTRIBUTORS | 1 + src/V3Options.cpp | 4 ++++ test_regress/t/t_lib_prot_delay_bad.pl | 1 + test_regress/t/t_lib_prot_exe_bad.out | 2 ++ test_regress/t/t_lib_prot_exe_bad.pl | 25 +++++++++++++++++++++++++ test_regress/t/t_lib_prot_inout_bad.pl | 1 + 6 files changed, 34 insertions(+) create mode 100644 test_regress/t/t_lib_prot_exe_bad.out create mode 100755 test_regress/t/t_lib_prot_exe_bad.pl diff --git a/docs/CONTRIBUTORS b/docs/CONTRIBUTORS index c9756852e..517d03f61 100644 --- a/docs/CONTRIBUTORS +++ b/docs/CONTRIBUTORS @@ -133,6 +133,7 @@ Victor Besyakov William D. Jones Wilson Snyder Xi Zhang +Yinan Xu Yoda Lee Yossi Nivin Yuri Victorovich diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 4f14b672e..ca7ee2f3f 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -761,6 +761,10 @@ void V3Options::notify() { cmdfl->v3error("--make cannot be used together with --build. Suggest see manual"); } + if (m_exe && !v3Global.opt.libCreate().empty()) { + cmdfl->v3error("--exe cannot be used together with --lib-create. Suggest see manual"); + } + // Make sure at least one make system is enabled if (!m_gmake && !m_cmake) m_gmake = true; diff --git a/test_regress/t/t_lib_prot_delay_bad.pl b/test_regress/t/t_lib_prot_delay_bad.pl index 7bb3853cf..802270587 100755 --- a/test_regress/t/t_lib_prot_delay_bad.pl +++ b/test_regress/t/t_lib_prot_delay_bad.pl @@ -18,6 +18,7 @@ compile ( "--timing", ], verilator_make_gcc => 0, + make_main => 0, fails => 1, expect_filename => $Self->{golden_filename}, ); diff --git a/test_regress/t/t_lib_prot_exe_bad.out b/test_regress/t/t_lib_prot_exe_bad.out new file mode 100644 index 000000000..7b64aaaa2 --- /dev/null +++ b/test_regress/t/t_lib_prot_exe_bad.out @@ -0,0 +1,2 @@ +%Error: --exe cannot be used together with --lib-create. Suggest see manual +%Error: Exiting due to diff --git a/test_regress/t/t_lib_prot_exe_bad.pl b/test_regress/t/t_lib_prot_exe_bad.pl new file mode 100755 index 000000000..a89483bf5 --- /dev/null +++ b/test_regress/t/t_lib_prot_exe_bad.pl @@ -0,0 +1,25 @@ +#!/usr/bin/env perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2022 by Yinan Xu. This program is free software; you +# can redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +scenarios(vlt => 1); + +compile ( + verilator_flags2 => ["--protect-lib", + "secret", + "--protect-key", + "secret-key", + ], + verilator_make_gcc => 0, + fails => 1, + expect_filename => $Self->{golden_filename}, + ); + +ok(1); +1; diff --git a/test_regress/t/t_lib_prot_inout_bad.pl b/test_regress/t/t_lib_prot_inout_bad.pl index d3c7f81d2..375b280ce 100755 --- a/test_regress/t/t_lib_prot_inout_bad.pl +++ b/test_regress/t/t_lib_prot_inout_bad.pl @@ -17,6 +17,7 @@ compile ( "secret-key" ], verilator_make_gcc => 0, + make_main => 0, fails => 1, expect_filename => $Self->{golden_filename}, );