diff options
Diffstat (limited to 'Userland/Utilities')
38 files changed, 120 insertions, 120 deletions
diff --git a/Userland/Utilities/arp.cpp b/Userland/Utilities/arp.cpp index 2be5ce7a26..2f29afbb31 100644 --- a/Userland/Utilities/arp.cpp +++ b/Userland/Utilities/arp.cpp @@ -41,7 +41,7 @@ int main() printf("Address HWaddress\n"); auto file_contents = file->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); json.value().as_array().for_each([](auto& value) { auto if_object = value.as_object(); diff --git a/Userland/Utilities/base64.cpp b/Userland/Utilities/base64.cpp index f8e0fc6ff9..030990c286 100644 --- a/Userland/Utilities/base64.cpp +++ b/Userland/Utilities/base64.cpp @@ -55,11 +55,11 @@ int main(int argc, char** argv) STDIN_FILENO, Core::IODevice::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes); - ASSERT(success); + VERIFY(success); buffer = file->read_all(); } else { auto result = Core::File::open(filepath, Core::IODevice::OpenMode::ReadOnly); - ASSERT(!result.is_error()); + VERIFY(!result.is_error()); auto file = result.value(); buffer = file->read_all(); } diff --git a/Userland/Utilities/copy.cpp b/Userland/Utilities/copy.cpp index 90d2e04430..2295703825 100644 --- a/Userland/Utilities/copy.cpp +++ b/Userland/Utilities/copy.cpp @@ -60,7 +60,7 @@ static Options parse_options(int argc, char* argv[]) STDIN_FILENO, Core::IODevice::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescriptor::No); - ASSERT(success); + VERIFY(success); auto buffer = c_stdin->read_all(); dbgln("Read size {}", buffer.size()); options.data = String((char*)buffer.data(), buffer.size()); diff --git a/Userland/Utilities/crash.cpp b/Userland/Utilities/crash.cpp index 188eb690aa..817dbc300e 100644 --- a/Userland/Utilities/crash.cpp +++ b/Userland/Utilities/crash.cpp @@ -72,7 +72,7 @@ public: printf("Unexpected error!\n"); break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } }; @@ -84,7 +84,7 @@ public: pid_t pid = fork(); if (pid < 0) { perror("fork"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } else if (pid == 0) { run_crash_and_print_if_error(); exit(0); @@ -342,7 +342,7 @@ int main(int argc, char** argv) if (do_failing_assertion || do_all_crash_types) { Crash("Perform a failing assertion", [] { - ASSERT(1 == 2); + VERIFY(1 == 2); return Crash::Failure::DidNotCrash; }).run(run_type); } diff --git a/Userland/Utilities/df.cpp b/Userland/Utilities/df.cpp index 53a79eb7aa..2ffab267e0 100644 --- a/Userland/Utilities/df.cpp +++ b/Userland/Utilities/df.cpp @@ -71,7 +71,7 @@ int main(int argc, char** argv) auto file_contents = file->read_all(); auto json_result = JsonValue::from_string(file_contents); - ASSERT(json_result.has_value()); + VERIFY(json_result.has_value()); auto json = json_result.value().as_array(); json.for_each([](auto& value) { auto fs_object = value.as_object(); diff --git a/Userland/Utilities/du.cpp b/Userland/Utilities/du.cpp index fed2898eb4..06f28569a8 100644 --- a/Userland/Utilities/du.cpp +++ b/Userland/Utilities/du.cpp @@ -124,7 +124,7 @@ int parse_args(int argc, char** argv, Vector<String>& files, DuOption& du_option if (exclude_from) { auto file = Core::File::construct(exclude_from); bool success = file->open(Core::IODevice::ReadOnly); - ASSERT(success); + VERIFY(success); if (const auto buff = file->read_all()) { String patterns = String::copy(buff, Chomp); du_option.excluded_patterns.append(patterns.split('\n')); diff --git a/Userland/Utilities/expr.cpp b/Userland/Utilities/expr.cpp index cfcc8f7ea3..f96a67c8fa 100644 --- a/Userland/Utilities/expr.cpp +++ b/Userland/Utilities/expr.cpp @@ -112,7 +112,7 @@ private: return converted.value(); fail("Not an integer: '{}'", as_string); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual String string() const override { @@ -122,7 +122,7 @@ private: case Type::String: return as_string; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual Type type() const override { return m_type; } @@ -176,7 +176,7 @@ private: return m_left->integer(); return m_right->integer(); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual String string() const override @@ -191,7 +191,7 @@ private: return m_left->string(); return m_right->string(); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual Type type() const override { @@ -205,7 +205,7 @@ private: return m_left->type(); return m_right->type(); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } BooleanOperator m_op { BooleanOperator::And }; @@ -264,7 +264,7 @@ private: case ComparisonOperation::Greater: return left != right && !(left < right); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual bool truth() const override @@ -275,7 +275,7 @@ private: case Type::String: return compare(m_left->string(), m_right->string()); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual int integer() const override { return truth(); } virtual String string() const override { return truth() ? "1" : "0"; } @@ -346,7 +346,7 @@ private: case ArithmeticOperation::Remainder: return left % right; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } virtual String string() const override { @@ -399,7 +399,7 @@ private: if (m_op == StringOperation::Length) return m_str->string().length(); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static auto safe_substring(const String& str, int start, int length) { diff --git a/Userland/Utilities/fgrep.cpp b/Userland/Utilities/fgrep.cpp index bf71e54c77..ed8ff4adc6 100644 --- a/Userland/Utilities/fgrep.cpp +++ b/Userland/Utilities/fgrep.cpp @@ -42,7 +42,7 @@ int main(int argc, char** argv) write(1, buf, strlen(buf)); if (feof(stdin)) return 0; - ASSERT(str); + VERIFY(str); } return 0; } diff --git a/Userland/Utilities/find.cpp b/Userland/Utilities/find.cpp index 872cf1717e..4f613a980d 100644 --- a/Userland/Utilities/find.cpp +++ b/Userland/Utilities/find.cpp @@ -110,7 +110,7 @@ private: return S_ISSOCK(type); default: // We've verified this is a correct character before. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -420,7 +420,7 @@ static NonnullOwnPtr<Command> parse_all_commands(char* argv[]) auto command = parse_complex_command(argv); if (g_have_seen_action_command) { - ASSERT(command); + VERIFY(command); return command.release_nonnull(); } @@ -461,7 +461,7 @@ static const char* parse_options(int argc, char* argv[]) g_follow_symlinks = true; break; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } } diff --git a/Userland/Utilities/functrace.cpp b/Userland/Utilities/functrace.cpp index 01059090f9..34d08d2ab9 100644 --- a/Userland/Utilities/functrace.cpp +++ b/Userland/Utilities/functrace.cpp @@ -170,7 +170,7 @@ int main(int argc, char** argv) } // FIXME: we could miss some leaf functions that were called with a jump - ASSERT(instruction.mnemonic() == "CALL"); + VERIFY(instruction.mnemonic() == "CALL"); ++depth; new_function = true; diff --git a/Userland/Utilities/grep.cpp b/Userland/Utilities/grep.cpp index 97d26d49e9..ecf73fb49c 100644 --- a/Userland/Utilities/grep.cpp +++ b/Userland/Utilities/grep.cpp @@ -195,7 +195,7 @@ int main(int argc, char** argv) ssize_t nread = 0; ScopeGuard free_line = [line] { free(line); }; while ((nread = getline(&line, &line_len, stdin)) != -1) { - ASSERT(nread > 0); + VERIFY(nread > 0); StringView line_view(line, nread - 1); bool is_binary = line_view.contains(0); diff --git a/Userland/Utilities/gron.cpp b/Userland/Utilities/gron.cpp index 0c1b50eca9..38359d515d 100644 --- a/Userland/Utilities/gron.cpp +++ b/Userland/Utilities/gron.cpp @@ -77,7 +77,7 @@ int main(int argc, char** argv) auto file_contents = file->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); if (use_color) { color_name = "\033[33;1m"; diff --git a/Userland/Utilities/gunzip.cpp b/Userland/Utilities/gunzip.cpp index b7081d4a54..8898cbae15 100644 --- a/Userland/Utilities/gunzip.cpp +++ b/Userland/Utilities/gunzip.cpp @@ -74,7 +74,7 @@ int main(int argc, char** argv) if (!keep_input_files) { const auto retval = unlink(String { input_filename }.characters()); - ASSERT(retval == 0); + VERIFY(retval == 0); } } } diff --git a/Userland/Utilities/ifconfig.cpp b/Userland/Utilities/ifconfig.cpp index 2a1b000d9b..78ed5ebac0 100644 --- a/Userland/Utilities/ifconfig.cpp +++ b/Userland/Utilities/ifconfig.cpp @@ -65,7 +65,7 @@ int main(int argc, char** argv) auto file_contents = file->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); json.value().as_array().for_each([](auto& value) { auto if_object = value.as_object(); diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index d7b48407fd..b2ee3ae9ef 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -323,7 +323,7 @@ static void print_typed_array(const JS::Object& object, HashTable<JS::Object*>& } JS_ENUMERATE_TYPED_ARRAYS #undef __JS_ENUMERATE - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static void print_primitive_wrapper_object(const FlyString& name, const JS::Object& object, HashTable<JS::Object*>& seen_objects) @@ -884,7 +884,7 @@ int main(int argc, char** argv) break; } default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return results; diff --git a/Userland/Utilities/ls.cpp b/Userland/Utilities/ls.cpp index 4c26dd68c8..3e3f74c75d 100644 --- a/Userland/Utilities/ls.cpp +++ b/Userland/Utilities/ls.cpp @@ -372,7 +372,7 @@ static int do_file_system_object_long(const char* path) while (di.has_next()) { FileMetadata metadata; metadata.name = di.next_path(); - ASSERT(!metadata.name.is_empty()); + VERIFY(!metadata.name.is_empty()); if (metadata.name.ends_with('~') && flag_ignore_backups && metadata.name != path) continue; @@ -382,7 +382,7 @@ static int do_file_system_object_long(const char* path) builder.append('/'); builder.append(metadata.name); metadata.path = builder.to_string(); - ASSERT(!metadata.path.is_null()); + VERIFY(!metadata.path.is_null()); int rc = lstat(metadata.path.characters(), &metadata.stat); if (rc < 0) { perror("lstat"); diff --git a/Userland/Utilities/lsirq.cpp b/Userland/Utilities/lsirq.cpp index 8a24308c20..82402cc1b8 100644 --- a/Userland/Utilities/lsirq.cpp +++ b/Userland/Utilities/lsirq.cpp @@ -59,7 +59,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv) printf("%4s %-10s\n", " ", "CPU0"); auto file_contents = proc_interrupts->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); json.value().as_array().for_each([](auto& value) { auto handler = value.as_object(); auto purpose = handler.get("purpose").to_string(); diff --git a/Userland/Utilities/lsof.cpp b/Userland/Utilities/lsof.cpp index 9a9bafa0bd..086d7812ea 100644 --- a/Userland/Utilities/lsof.cpp +++ b/Userland/Utilities/lsof.cpp @@ -95,7 +95,7 @@ static Vector<OpenFile> get_open_files_by_pid(pid_t pid) auto result = parser.parse(); if (!result.has_value()) { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } Vector<OpenFile> files; @@ -105,7 +105,7 @@ static Vector<OpenFile> get_open_files_by_pid(pid_t pid) open_file.fd = object.as_object().get("fd").to_int(); String name = object.as_object().get("absolute_path").to_string(); - ASSERT(parse_name(name, open_file)); + VERIFY(parse_name(name, open_file)); open_file.full_name = name; files.append(open_file); diff --git a/Userland/Utilities/lspci.cpp b/Userland/Utilities/lspci.cpp index 45a3f48932..388e59b55c 100644 --- a/Userland/Utilities/lspci.cpp +++ b/Userland/Utilities/lspci.cpp @@ -86,7 +86,7 @@ int main(int argc, char** argv) auto file_contents = proc_pci->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); json.value().as_array().for_each([db, format](auto& value) { auto dev = value.as_object(); auto seg = dev.get("seg").to_u32(); diff --git a/Userland/Utilities/man.cpp b/Userland/Utilities/man.cpp index fc54db06e6..971e075d83 100644 --- a/Userland/Utilities/man.cpp +++ b/Userland/Utilities/man.cpp @@ -114,7 +114,7 @@ int main(int argc, char* argv[]) printf("%s(%s)\t\tSerenityOS manual\n", name, section); auto document = Markdown::Document::parse(source); - ASSERT(document); + VERIFY(document); String rendered = document->render_for_terminal(view_width); printf("%s", rendered.characters()); diff --git a/Userland/Utilities/mount.cpp b/Userland/Utilities/mount.cpp index d9d831d1c1..f475d271ee 100644 --- a/Userland/Utilities/mount.cpp +++ b/Userland/Utilities/mount.cpp @@ -145,7 +145,7 @@ static bool print_mounts() auto content = df->read_all(); auto json = JsonValue::from_string(content); - ASSERT(json.has_value()); + VERIFY(json.has_value()); json.value().as_array().for_each([](auto& value) { auto fs_object = value.as_object(); diff --git a/Userland/Utilities/ntpquery.cpp b/Userland/Utilities/ntpquery.cpp index 07003b4f38..692a5b4d54 100644 --- a/Userland/Utilities/ntpquery.cpp +++ b/Userland/Utilities/ntpquery.cpp @@ -74,7 +74,7 @@ const unsigned SecondsFrom1900To1970 = (70u * 365u + 70u / 4u) * 24u * 60u * 60u static NtpTimestamp ntp_timestamp_from_timeval(const timeval& t) { - ASSERT(t.tv_usec >= 0 && t.tv_usec < 1'000'000); // Fits in 20 bits when normalized. + VERIFY(t.tv_usec >= 0 && t.tv_usec < 1'000'000); // Fits in 20 bits when normalized. // Seconds just need translation to the different origin. uint32_t seconds = t.tv_sec + SecondsFrom1900To1970; @@ -100,9 +100,9 @@ static String format_ntp_timestamp(NtpTimestamp ntp_timestamp) struct tm tm; gmtime_r(&t.tv_sec, &tm); size_t written = strftime(buffer, sizeof(buffer), "%Y-%m-%dT%T.", &tm); - ASSERT(written == 20); + VERIFY(written == 20); written += snprintf(buffer + written, sizeof(buffer) - written, "%06d", (int)t.tv_usec); - ASSERT(written == 26); + VERIFY(written == 26); buffer[written++] = 'Z'; buffer[written] = '\0'; return buffer; @@ -231,9 +231,9 @@ int main(int argc, char** argv) } cmsghdr* cmsg = CMSG_FIRSTHDR(&msg); - ASSERT(cmsg->cmsg_level == SOL_SOCKET); - ASSERT(cmsg->cmsg_type == SCM_TIMESTAMP); - ASSERT(!CMSG_NXTHDR(&msg, cmsg)); + VERIFY(cmsg->cmsg_level == SOL_SOCKET); + VERIFY(cmsg->cmsg_type == SCM_TIMESTAMP); + VERIFY(!CMSG_NXTHDR(&msg, cmsg)); timeval kernel_receive_time; memcpy(&kernel_receive_time, CMSG_DATA(cmsg), sizeof(kernel_receive_time)); diff --git a/Userland/Utilities/ping.cpp b/Userland/Utilities/ping.cpp index 78bf70ddfa..977b97c929 100644 --- a/Userland/Utilities/ping.cpp +++ b/Userland/Utilities/ping.cpp @@ -164,7 +164,7 @@ int main(int argc, char** argv) bool fits = String("Hello there!\n").copy_characters_to_buffer(ping_packet.msg, sizeof(ping_packet.msg)); // It's a constant string, we can be sure that it fits. - ASSERT(fits); + VERIFY(fits); ping_packet.header.checksum = internet_checksum(&ping_packet, sizeof(PingPacket)); diff --git a/Userland/Utilities/pmap.cpp b/Userland/Utilities/pmap.cpp index e0a6a17611..b752ecb3cb 100644 --- a/Userland/Utilities/pmap.cpp +++ b/Userland/Utilities/pmap.cpp @@ -70,7 +70,7 @@ int main(int argc, char** argv) auto file_contents = file->read_all(); auto json = JsonValue::from_string(file_contents); - ASSERT(json.has_value()); + VERIFY(json.has_value()); Vector<JsonValue> sorted_regions = json.value().as_array().values(); quick_sort(sorted_regions, [](auto& a, auto& b) { diff --git a/Userland/Utilities/printf.cpp b/Userland/Utilities/printf.cpp index bb434e761c..97fe8e64be 100644 --- a/Userland/Utilities/printf.cpp +++ b/Userland/Utilities/printf.cpp @@ -205,7 +205,7 @@ template<typename V> struct ArgvNextArgument<int*, V> { ALWAYS_INLINE int* operator()(V) const { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return nullptr; } }; diff --git a/Userland/Utilities/strace.cpp b/Userland/Utilities/strace.cpp index 64d005cfbb..c43f987e51 100644 --- a/Userland/Utilities/strace.cpp +++ b/Userland/Utilities/strace.cpp @@ -105,7 +105,7 @@ int main(int argc, char** argv) perror("execvp"); exit(1); } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } g_pid = pid; diff --git a/Userland/Utilities/syscall.cpp b/Userland/Utilities/syscall.cpp index 1742821acf..f5275f75be 100644 --- a/Userland/Utilities/syscall.cpp +++ b/Userland/Utilities/syscall.cpp @@ -143,7 +143,7 @@ static FlatPtr parse_parameter_buffer(ArgIter& iter) fprintf(stderr, "Error: Unmatched '['?!\n"); exit(1); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } static FlatPtr parse_from(ArgIter& iter) diff --git a/Userland/Utilities/tar.cpp b/Userland/Utilities/tar.cpp index b828e3d8d1..a3ce48d49e 100644 --- a/Userland/Utilities/tar.cpp +++ b/Userland/Utilities/tar.cpp @@ -120,7 +120,7 @@ int main(int argc, char** argv) } default: // FIXME: Implement other file types - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } } @@ -129,7 +129,7 @@ int main(int argc, char** argv) } // FIXME: Implement other operations. - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); return 0; } diff --git a/Userland/Utilities/test-js.cpp b/Userland/Utilities/test-js.cpp index 52996c6b93..f5f8489c6e 100644 --- a/Userland/Utilities/test-js.cpp +++ b/Userland/Utilities/test-js.cpp @@ -121,7 +121,7 @@ public: : m_test_root(move(test_root)) , m_print_times(print_times) { - ASSERT(!s_the); + VERIFY(!s_the); s_the = this; } @@ -201,7 +201,7 @@ static double get_time_in_ms() { struct timeval tv1; auto return_code = gettimeofday(&tv1, nullptr); - ASSERT(return_code >= 0); + VERIFY(return_code >= 0); return static_cast<double>(tv1.tv_sec) * 1000.0 + static_cast<double>(tv1.tv_usec) / 1000.0; } @@ -334,16 +334,16 @@ JSFileResult TestRunner::run_file_test(const String& test_path) test_json.value().as_object().for_each_member([&](const String& suite_name, const JsonValue& suite_value) { JSSuite suite { suite_name }; - ASSERT(suite_value.is_object()); + VERIFY(suite_value.is_object()); suite_value.as_object().for_each_member([&](const String& test_name, const JsonValue& test_value) { JSTest test { test_name, TestResult::Fail, "" }; - ASSERT(test_value.is_object()); - ASSERT(test_value.as_object().has("result")); + VERIFY(test_value.is_object()); + VERIFY(test_value.as_object().has("result")); auto result = test_value.as_object().get("result"); - ASSERT(result.is_string()); + VERIFY(result.is_string()); auto result_string = result.as_string(); if (result_string == "pass") { test.result = TestResult::Pass; @@ -352,9 +352,9 @@ JSFileResult TestRunner::run_file_test(const String& test_path) test.result = TestResult::Fail; m_counts.tests_failed++; suite.most_severe_test_result = TestResult::Fail; - ASSERT(test_value.as_object().has("details")); + VERIFY(test_value.as_object().has("details")); auto details = test_value.as_object().get("details"); - ASSERT(result.is_string()); + VERIFY(result.is_string()); test.details = details.as_string(); } else { test.result = TestResult::Skip; @@ -425,7 +425,7 @@ static void print_modifiers(Vector<Modifier> modifiers) case CLEAR: return "\033[0m"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }(); out("{}", code); } @@ -625,7 +625,7 @@ JSFileResult Test262ParserTestRunner::run_file_test(const String& test_path) } else if (dirname.ends_with("pass") || dirname.ends_with("pass-explicit")) { expecting_file_to_parse = true; } else { - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto start_time = get_time_in_ms(); diff --git a/Userland/Utilities/test-pthread.cpp b/Userland/Utilities/test-pthread.cpp index 36914f6634..ba56367410 100644 --- a/Userland/Utilities/test-pthread.cpp +++ b/Userland/Utilities/test-pthread.cpp @@ -50,7 +50,7 @@ static void test_once() for (auto& thread : threads) [[maybe_unused]] auto res = thread.join(); - ASSERT(v.size() == 1); + VERIFY(v.size() == 1); } int main() diff --git a/Userland/Utilities/test-web.cpp b/Userland/Utilities/test-web.cpp index 040eb90a3e..2b918b012c 100644 --- a/Userland/Utilities/test-web.cpp +++ b/Userland/Utilities/test-web.cpp @@ -186,7 +186,7 @@ static double get_time_in_ms() { struct timeval tv1; auto return_code = gettimeofday(&tv1, nullptr); - ASSERT(return_code >= 0); + VERIFY(return_code >= 0); return static_cast<double>(tv1.tv_sec) * 1000.0 + static_cast<double>(tv1.tv_usec) / 1000.0; } @@ -230,7 +230,7 @@ void TestRunner::run() cleanup_and_exit(); } - ASSERT(m_page_view->document()); + VERIFY(m_page_view->document()); // We want to keep the same document since the interpreter is tied to the document, // and we don't want to lose the test state. So, we just clear the document and @@ -303,7 +303,7 @@ static Optional<JsonValue> get_test_results(JS::Interpreter& interpreter) JSFileResult TestRunner::run_file_test(const String& test_path) { double start_time = get_time_in_ms(); - ASSERT(m_page_view->document()); + VERIFY(m_page_view->document()); auto& old_interpreter = m_page_view->document()->interpreter(); if (!m_js_test_common) { @@ -396,16 +396,16 @@ JSFileResult TestRunner::run_file_test(const String& test_path) test_json.value().as_object().for_each_member([&](const String& suite_name, const JsonValue& suite_value) { JSSuite suite { suite_name }; - ASSERT(suite_value.is_object()); + VERIFY(suite_value.is_object()); suite_value.as_object().for_each_member([&](const String& test_name, const JsonValue& test_value) { JSTest test { test_name, TestResult::Fail, "" }; - ASSERT(test_value.is_object()); - ASSERT(test_value.as_object().has("result")); + VERIFY(test_value.is_object()); + VERIFY(test_value.as_object().has("result")); auto result = test_value.as_object().get("result"); - ASSERT(result.is_string()); + VERIFY(result.is_string()); auto result_string = result.as_string(); if (result_string == "pass") { test.result = TestResult::Pass; @@ -414,9 +414,9 @@ JSFileResult TestRunner::run_file_test(const String& test_path) test.result = TestResult::Fail; m_counts.tests_failed++; suite.most_severe_test_result = TestResult::Fail; - ASSERT(test_value.as_object().has("details")); + VERIFY(test_value.as_object().has("details")); auto details = test_value.as_object().get("details"); - ASSERT(result.is_string()); + VERIFY(result.is_string()); test.details = details.as_string(); } else { test.result = TestResult::Skip; @@ -492,7 +492,7 @@ static void print_modifiers(Vector<Modifier> modifiers) case CLEAR: return "\033[0m"; } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); }; printf("%s", code().characters()); } diff --git a/Userland/Utilities/test.cpp b/Userland/Utilities/test.cpp index a81c84933c..0cf039e135 100644 --- a/Userland/Utilities/test.cpp +++ b/Userland/Utilities/test.cpp @@ -158,7 +158,7 @@ private: case SymbolicLink: return S_ISLNK(statbuf.st_mode); default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -193,7 +193,7 @@ private: case Any: return access(m_path.characters(), F_OK) == 0; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -272,7 +272,7 @@ private: case NotEqual: return m_lhs != m_rhs; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } @@ -325,7 +325,7 @@ private: case ModificationTimestampGreater: return statbuf_l.st_mtime > statbuf_r.st_mtime; default: - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Utilities/test_efault.cpp b/Userland/Utilities/test_efault.cpp index b063fcfb78..ba46c8f3f0 100644 --- a/Userland/Utilities/test_efault.cpp +++ b/Userland/Utilities/test_efault.cpp @@ -62,14 +62,14 @@ int main(int, char**) // Test a one-page mapping (4KB) u8* one_page = (u8*)mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); - ASSERT(one_page); + VERIFY(one_page); EXPECT_OK(read, one_page, 4096); EXPECT_EFAULT(read, one_page, 4097); EXPECT_EFAULT(read, one_page - 1, 4096); // Test a two-page mapping (8KB) u8* two_page = (u8*)mmap(nullptr, 8192, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); - ASSERT(two_page); + VERIFY(two_page); EXPECT_OK(read, two_page, 4096); EXPECT_OK(read, two_page + 4096, 4096); @@ -93,7 +93,7 @@ int main(int, char**) // Test the page just below where the kernel VM begins. u8* jerk_page = (u8*)mmap((void*)(0xc0000000 - PAGE_SIZE), PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, 0, 0); - ASSERT(jerk_page == (void*)(0xc0000000 - PAGE_SIZE)); + VERIFY(jerk_page == (void*)(0xc0000000 - PAGE_SIZE)); EXPECT_OK(read, jerk_page, 4096); EXPECT_EFAULT(read, jerk_page, 4097); diff --git a/Userland/Utilities/test_env.cpp b/Userland/Utilities/test_env.cpp index ce5467ecf9..f8019cf59b 100644 --- a/Userland/Utilities/test_env.cpp +++ b/Userland/Utilities/test_env.cpp @@ -35,11 +35,11 @@ static void assert_env(const char* name, const char* value) if (!result) { perror("getenv"); printf("(When reading value for '%s'; we expected '%s'.)\n", name, value); - ASSERT(false); + VERIFY(false); } if (strcmp(result, value) != 0) { printf("Expected '%s', got '%s' instead.\n", value, result); - ASSERT(false); + VERIFY(false); } } @@ -54,7 +54,7 @@ static void test_puttenv() int rc = putenv(to_put); if (rc) { perror("putenv"); - ASSERT(false); + VERIFY(false); } assert_env("PUTENVTEST", "HELLOPUTENV"); // Do not free `to_put`! @@ -65,7 +65,7 @@ static void test_settenv() int rc = setenv("SETENVTEST", "HELLO SETENV!", 0); if (rc) { perror("setenv"); - ASSERT(false); + VERIFY(false); } // This used to trigger a very silly bug! :) assert_env("SETENVTEST", "HELLO SETENV!"); @@ -73,14 +73,14 @@ static void test_settenv() rc = setenv("SETENVTEST", "How are you today?", 0); if (rc) { perror("setenv"); - ASSERT(false); + VERIFY(false); } assert_env("SETENVTEST", "HELLO SETENV!"); rc = setenv("SETENVTEST", "Goodbye, friend!", 1); if (rc) { perror("setenv"); - ASSERT(false); + VERIFY(false); } assert_env("SETENVTEST", "Goodbye, friend!"); } @@ -90,7 +90,7 @@ static void test_settenv_overwrite_empty() int rc = setenv("EMPTYTEST", "Forcefully overwrite non-existing envvar", 1); if (rc) { perror("setenv"); - ASSERT(false); + VERIFY(false); } assert_env("EMPTYTEST", "Forcefully overwrite non-existing envvar"); } diff --git a/Userland/Utilities/test_io.cpp b/Userland/Utilities/test_io.cpp index 316840a8e5..404d76f2b9 100644 --- a/Userland/Utilities/test_io.cpp +++ b/Userland/Utilities/test_io.cpp @@ -56,11 +56,11 @@ static void test_read_from_directory() { char buffer[BUFSIZ]; int fd = open("/", O_DIRECTORY | O_RDONLY); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; EXPECT_ERROR_3(EISDIR, read, fd, buffer, sizeof(buffer)); rc = close(fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } static void test_write_to_directory() @@ -69,33 +69,33 @@ static void test_write_to_directory() int fd = open("/", O_DIRECTORY | O_RDONLY); if (fd < 0) perror("open"); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; EXPECT_ERROR_3(EBADF, write, fd, str, sizeof(str)); rc = close(fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } static void test_read_from_writeonly() { char buffer[BUFSIZ]; int fd = open("/tmp/xxxx123", O_CREAT | O_WRONLY); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; EXPECT_ERROR_3(EBADF, read, fd, buffer, sizeof(buffer)); rc = close(fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } static void test_write_to_readonly() { char str[] = "hello"; int fd = open("/tmp/abcd123", O_CREAT | O_RDONLY); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; EXPECT_ERROR_3(EBADF, write, fd, str, sizeof(str)); rc = close(fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } static void test_read_past_eof() @@ -104,7 +104,7 @@ static void test_read_past_eof() int fd = open("/home/anon/myfile.txt", O_RDONLY); if (fd < 0) perror("open"); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; rc = lseek(fd, 9999, SEEK_SET); if (rc < 0) @@ -115,13 +115,13 @@ static void test_read_past_eof() if (rc > 0) fprintf(stderr, "read %d bytes past EOF\n", rc); rc = close(fd); - ASSERT(rc == 0); + VERIFY(rc == 0); } static void test_ftruncate_readonly() { int fd = open("/tmp/trunctest", O_RDONLY | O_CREAT, 0666); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; EXPECT_ERROR_2(EBADF, ftruncate, fd, 0); close(fd); @@ -130,7 +130,7 @@ static void test_ftruncate_readonly() static void test_ftruncate_negative() { int fd = open("/tmp/trunctest", O_RDWR | O_CREAT, 0666); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc; EXPECT_ERROR_2(EINVAL, ftruncate, fd, -1); close(fd); @@ -139,7 +139,7 @@ static void test_ftruncate_negative() static void test_mmap_directory() { int fd = open("/tmp", O_RDONLY | O_DIRECTORY); - ASSERT(fd >= 0); + VERIFY(fd >= 0); auto* ptr = mmap(nullptr, 4096, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0); if (ptr != MAP_FAILED) { fprintf(stderr, "Boo! mmap() of a directory succeeded!\n"); @@ -155,13 +155,13 @@ static void test_mmap_directory() static void test_tmpfs_read_past_end() { int fd = open("/tmp/x", O_RDWR | O_CREAT | O_TRUNC, 0600); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc = ftruncate(fd, 1); - ASSERT(rc == 0); + VERIFY(rc == 0); rc = lseek(fd, 4096, SEEK_SET); - ASSERT(rc == 4096); + VERIFY(rc == 4096); char buffer[16]; int nread = read(fd, buffer, sizeof(buffer)); @@ -174,10 +174,10 @@ static void test_tmpfs_read_past_end() static void test_procfs_read_past_end() { int fd = open("/proc/uptime", O_RDONLY); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc = lseek(fd, 4096, SEEK_SET); - ASSERT(rc == 4096); + VERIFY(rc == 4096); char buffer[16]; int nread = read(fd, buffer, sizeof(buffer)); @@ -190,12 +190,12 @@ static void test_procfs_read_past_end() static void test_open_create_device() { int fd = open("/tmp/fakedevice", (O_RDWR | O_CREAT), (S_IFCHR | 0600)); - ASSERT(fd >= 0); + VERIFY(fd >= 0); struct stat st; if (fstat(fd, &st) < 0) { perror("stat"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (st.st_mode != 0100600) { @@ -210,11 +210,11 @@ static void test_unlink_symlink() int rc = symlink("/proc/2/foo", "/tmp/linky"); if (rc < 0) { perror("symlink"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } auto target = Core::File::read_link("/tmp/linky"); - ASSERT(target == "/proc/2/foo"); + VERIFY(target == "/proc/2/foo"); rc = unlink("/tmp/linky"); if (rc < 0) { @@ -226,10 +226,10 @@ static void test_unlink_symlink() static void test_eoverflow() { int fd = open("/tmp/x", O_RDWR); - ASSERT(fd >= 0); + VERIFY(fd >= 0); int rc = lseek(fd, INT32_MAX, SEEK_SET); - ASSERT(rc == INT32_MAX); + VERIFY(rc == INT32_MAX); char buffer[16]; rc = read(fd, buffer, sizeof(buffer)); @@ -246,13 +246,13 @@ static void test_eoverflow() static void test_rmdir_while_inside_dir() { int rc = mkdir("/home/anon/testdir", 0700); - ASSERT(rc == 0); + VERIFY(rc == 0); rc = chdir("/home/anon/testdir"); - ASSERT(rc == 0); + VERIFY(rc == 0); rc = rmdir("/home/anon/testdir"); - ASSERT(rc == 0); + VERIFY(rc == 0); int fd = open("x", O_CREAT | O_RDWR, 0600); if (fd >= 0 || errno != ENOENT) { @@ -260,7 +260,7 @@ static void test_rmdir_while_inside_dir() } rc = chdir("/home/anon"); - ASSERT(rc == 0); + VERIFY(rc == 0); } static void test_writev() @@ -276,18 +276,18 @@ static void test_writev() int nwritten = writev(pipefds[1], iov, 2); if (nwritten < 0) { perror("writev"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } if (nwritten != 12) { fprintf(stderr, "Didn't write 12 bytes to pipe with writev\n"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } char buffer[32]; int nread = read(pipefds[0], buffer, sizeof(buffer)); if (nread != 12 || memcmp(buffer, "HelloFriends", 12)) { fprintf(stderr, "Didn't read the expected data from pipe after writev\n"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } close(pipefds[0]); @@ -299,7 +299,7 @@ static void test_rmdir_root() int rc = rmdir("/"); if (rc != -1 || errno != EBUSY) { warnln("rmdir(/) didn't fail with EBUSY"); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Utilities/unzip.cpp b/Userland/Utilities/unzip.cpp index d21228c822..d62d1d3d9b 100644 --- a/Userland/Utilities/unzip.cpp +++ b/Userland/Utilities/unzip.cpp @@ -101,7 +101,7 @@ static bool unpack_file_for_central_directory_index(off_t central_directory_inde return false; auto compression_method = buffer[1] << 8 | buffer[0]; // FIXME: Remove once any decompression is supported. - ASSERT(compression_method == None); + VERIFY(compression_method == None); if (!seek_and_read(buffer, file, local_file_header_index + LFHCompressedSizeOffset, 4)) return false; diff --git a/Userland/Utilities/utmpupdate.cpp b/Userland/Utilities/utmpupdate.cpp index cb18839f7b..17db0f568e 100644 --- a/Userland/Utilities/utmpupdate.cpp +++ b/Userland/Utilities/utmpupdate.cpp @@ -96,7 +96,7 @@ int main(int argc, char** argv) entry.set("login_at", time(nullptr)); json.set(tty_name, move(entry)); } else { - ASSERT(flag_delete); + VERIFY(flag_delete); dbgln("Removing {} from utmp", tty_name); json.remove(tty_name); } diff --git a/Userland/Utilities/watch.cpp b/Userland/Utilities/watch.cpp index 1377a7667c..c7e9e3a547 100644 --- a/Userland/Utilities/watch.cpp +++ b/Userland/Utilities/watch.cpp @@ -98,7 +98,7 @@ static int run_command(const Vector<const char*>& command) do { exited_pid = waitpid(child_pid, &status, 0); } while (exited_pid < 0 && errno == EINTR); - ASSERT(exited_pid == child_pid); + VERIFY(exited_pid == child_pid); child_pid = -1; if (exited_pid < 0) { perror("waitpid"); |