diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-03-03 22:09:50 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-03-03 22:21:03 -0800 |
commit | 71e4f3812982dba2efb471283d310224e8db363e (patch) | |
tree | ea111a1acb8b8845dbda39c0e1b4bac1d198143b /003trace.test.cc | |
parent | c6b928be29ac8cdb4e4d6e1eaa20420ff03e5a4c (diff) | |
download | mu-71e4f3812982dba2efb471283d310224e8db363e.tar.gz |
7842 - new directory organization
Baremetal is now the default build target and therefore has its sources at the top-level. Baremetal programs build using the phase-2 Mu toolchain that requires a Linux kernel. This phase-2 codebase which used to be at the top-level is now under the linux/ directory. Finally, the phase-2 toolchain, while self-hosting, has a way to bootstrap from a C implementation, which is now stored in linux/bootstrap. The bootstrap C implementation uses some literate programming tools that are now in linux/bootstrap/tools. So the whole thing has gotten inverted. Each directory should build one artifact and include the main sources (along with standard library). Tools used for building it are relegated to sub-directories, even though those tools are often useful in their own right, and have had lots of interesting programs written using them. A couple of things have gotten dropped in this process: - I had old ways to run on just a Linux kernel, or with a Soso kernel. No more. - I had some old tooling for running a single test at the cursor. I haven't used that lately. Maybe I'll bring it back one day. The reorg isn't done yet. Still to do: - redo documentation everywhere. All the README files, all other markdown, particularly vocabulary.md. - clean up how-to-run comments at the start of programs everywhere - rethink what to do with the html/ directory. Do we even want to keep supporting it? In spite of these shortcomings, all the scripts at the top-level, linux/ and linux/bootstrap are working. The names of the scripts also feel reasonable. This is a good milestone to take stock at.
Diffstat (limited to '003trace.test.cc')
-rw-r--r-- | 003trace.test.cc | 133 |
1 files changed, 0 insertions, 133 deletions
diff --git a/003trace.test.cc b/003trace.test.cc deleted file mode 100644 index bec1b789..00000000 --- a/003trace.test.cc +++ /dev/null @@ -1,133 +0,0 @@ -void test_trace_check_compares() { - trace("test layer") << "foo" << end(); - CHECK_TRACE_CONTENTS("test layer: foo"); -} - -void test_trace_check_ignores_other_layers() { - trace("test layer 1") << "foo" << end(); - trace("test layer 2") << "bar" << end(); - CHECK_TRACE_CONTENTS("test layer 1: foo"); - CHECK_TRACE_DOESNT_CONTAIN("test layer 2: foo"); -} - -void test_trace_check_ignores_leading_whitespace() { - trace("test layer 1") << " foo" << end(); - CHECK_EQ(trace_count("test layer 1", /*too little whitespace*/"foo"), 1); - CHECK_EQ(trace_count("test layer 1", /*too much whitespace*/" foo"), 1); -} - -void test_trace_check_ignores_other_lines() { - trace("test layer 1") << "foo" << end(); - trace("test layer 1") << "bar" << end(); - CHECK_TRACE_CONTENTS("test layer 1: foo"); -} - -void test_trace_check_ignores_other_lines2() { - trace("test layer 1") << "foo" << end(); - trace("test layer 1") << "bar" << end(); - CHECK_TRACE_CONTENTS("test layer 1: bar"); -} - -void test_trace_ignores_trailing_whitespace() { - trace("test layer 1") << "foo\n" << end(); - CHECK_TRACE_CONTENTS("test layer 1: foo"); -} - -void test_trace_ignores_trailing_whitespace2() { - trace("test layer 1") << "foo " << end(); - CHECK_TRACE_CONTENTS("test layer 1: foo"); -} - -void test_trace_orders_across_layers() { - trace("test layer 1") << "foo" << end(); - trace("test layer 2") << "bar" << end(); - trace("test layer 1") << "qux" << end(); - CHECK_TRACE_CONTENTS("test layer 1: foo\n" - "test layer 2: bar\n" - "test layer 1: qux\n"); -} - -void test_trace_supports_count() { - trace("test layer 1") << "foo" << end(); - trace("test layer 1") << "foo" << end(); - CHECK_EQ(trace_count("test layer 1", "foo"), 2); -} - -void test_trace_supports_count2() { - trace("test layer 1") << "foo" << end(); - trace("test layer 1") << "bar" << end(); - CHECK_EQ(trace_count("test layer 1"), 2); -} - -void test_trace_count_ignores_trailing_whitespace() { - trace("test layer 1") << "foo\n" << end(); - CHECK_EQ(trace_count("test layer 1", "foo"), 1); -} - -void test_trace_unescapes_newlines() { - trace("test layer 1") << "f\no\no\n" << end(); - CHECK_TRACE_CONTENTS("test layer 1: f\\no\\no"); -} - -// pending: DUMP tests -// pending: readable_contents() adds newline if necessary. -// pending: raise also prints to stderr. -// pending: raise doesn't print to stderr if Hide_errors is set. -// pending: warn doesn't print to stderr if Hide_errors is set. -// pending: warn doesn't print to stderr if Hide_warnings is set. -// pending: raise doesn't have to be saved if Hide_errors is set, just printed. -// pending: raise prints to stderr if Trace_stream is NULL. -// pending: raise prints to stderr if Trace_stream is NULL even if Hide_errors is set. - -// can't check trace because trace methods call 'split' - -void test_split_returns_at_least_one_elem() { - vector<string> result = split("", ","); - CHECK_EQ(result.size(), 1); - CHECK_EQ(result.at(0), ""); -} - -void test_split_returns_entire_input_when_no_delim() { - vector<string> result = split("abc", ","); - CHECK_EQ(result.size(), 1); - CHECK_EQ(result.at(0), "abc"); -} - -void test_split_works() { - vector<string> result = split("abc,def", ","); - CHECK_EQ(result.size(), 2); - CHECK_EQ(result.at(0), "abc"); - CHECK_EQ(result.at(1), "def"); -} - -void test_split_works2() { - vector<string> result = split("abc,def,ghi", ","); - CHECK_EQ(result.size(), 3); - CHECK_EQ(result.at(0), "abc"); - CHECK_EQ(result.at(1), "def"); - CHECK_EQ(result.at(2), "ghi"); -} - -void test_split_handles_multichar_delim() { - vector<string> result = split("abc,,def,,ghi", ",,"); - CHECK_EQ(result.size(), 3); - CHECK_EQ(result.at(0), "abc"); - CHECK_EQ(result.at(1), "def"); - CHECK_EQ(result.at(2), "ghi"); -} - -void test_trim() { - CHECK_EQ(trim(""), ""); - CHECK_EQ(trim(" "), ""); - CHECK_EQ(trim(" "), ""); - CHECK_EQ(trim("a"), "a"); - CHECK_EQ(trim(" a"), "a"); - CHECK_EQ(trim(" a"), "a"); - CHECK_EQ(trim(" ab"), "ab"); - CHECK_EQ(trim("a "), "a"); - CHECK_EQ(trim("a "), "a"); - CHECK_EQ(trim("ab "), "ab"); - CHECK_EQ(trim(" a "), "a"); - CHECK_EQ(trim(" a "), "a"); - CHECK_EQ(trim(" ab "), "ab"); -} |