Skip to content

How Novis is tested

Novis runs web servers. A bug in Novis could show one user’s data to another user, crash a server or make it slow. This page shows every way we look for these bugs.

Many of the methods have technical names, such as Miri or fuzzing. Each one gets a comparison from everyday life, so you do not need to know any of the tools. Every claim links to the setup in the repository, so you can check it yourself.

The map shows the six kinds of problem we test for. Select a name to read how that test works.

These are the largest groups of tests, counted from the repository:

Kind of test Count What it checks
Answer-key tests at least 4,300 each rule of the language, with the exact output or error
Part tests in Rust at least 10,000 the compiler, the runtime and the library, from the inside
Examples at least 5,200 each example runs, and its output matches a saved file
Attack programs at least 1,900 Novis does not crash or hang, and stops what it must not allow
Benchmarks at least 1,900 the speed of each feature, and how its cost grows
Editor tests at least 800 completion, hover and errors in the editor

Fast checks run on every change. Slow checks run every night, when they delay nobody.

  1. The developer's computerbefore a change is committed
    • Build Novis
    • Check the formatting
    • Run every test the change can reach
    • Run the linter, where a warning is an error
  2. Every pushfor the parts the change touches
    • Tests on Linux, Windows and macOS
    • Attack programs
    • Examples and the website
    • Speed limits
    • AddressSanitizer and ThreadSanitizer
  3. Every nightat 03:00 UTC, for every part
    • Every check from a push
    • Fuzzing
    • Miri
    • The memory soak test
    • The unsafe code count
  4. Every releasestarted by a person
    • Every check, one more time
    • Builds for Linux, Windows and macOS
    • Each Docker image is started once
    • A signed record of each build
A release is built only when every check is green.

A push runs the checks for the parts of Novis that the change touches. A change to the website does not test the compiler again. Every night, every check runs for every part. A release runs all of them once more, and it is built only when they all pass. See the CI setup.

No single test finds every bug. Safety engineers draw this as slices of Swiss cheese. Each slice has holes, but the holes are in different places. A bug that passes one slice is stopped by a later one.

Pick a bug. The drawing shows which layer stops it.

Pick a bug

12345

1. Tests on every change. An answer-key test prints a different number than its saved answer. The test fails before the change is committed.

12345

2. Attack programs. An attack program stores data in one request and tries to read it in the next. The attack test fails if it finds anything.

12345

3. Fuzzing. Every night, fuzzing sends random headers to the code that reads requests. When one causes a crash, the fuzzer saves it so we can fix it.

12345

4. Miri and the sanitizers. Miri and AddressSanitizer check each memory access. They report the error even when the program printed the right answer.

12345

5. Limits while the server runs. Each request has a memory limit. The request stops when it goes over. The server and every other request keep running.

  1. Tests on every change
  2. Attack programs
  3. Fuzzing
  4. Miri and the sanitizers
  5. Limits while the server runs

These tests check that Novis gives the right answer. Most of them compare the output with a saved answer.

Answer-key teststhe teacher's answer sheet

  • every change
  • every push

A teacher checks each test against an answer sheet. Every answer must match exactly. One wrong number, and the answer is wrong.

How it works

Each answer-key test is a short Novis program and the exact output it must print. When the program must not compile, the test has the exact error message instead. There are at least 4,300 of them. They cover the rules of the language and every function of the library.

Each test runs a second time with the optimiser turned off. This is like doing a sum in two different ways. Both results must be the same. If they are not, the optimiser changed what the program does.

Part tests in Rusteach car part on the test bench

  • every change
  • every push

A car factory tests each part on a bench before it goes into a car. The brakes are tested long before anybody drives the car.

How it works

Novis itself is written in the Rust language. at least 10,000 small tests check its parts from the inside: the parser, the compiler, the runtime and the library. Some test a single function. Others start a real server and send it requests.

Examples with saved outputthe photo in the cookbook

  • every change
  • every push

A good cookbook has a photo of every dish. Imagine that every recipe is cooked again after each change, and the result is compared with its photo.

How it works

Every feature has at least three example programs, and each one has a file with its exact output. The examples run, and their output must match the file. There are at least 5,200 of them. The examples on this website are the same files, so every example you read has been run.

Snapshot testsspot the difference

  • every change
  • every push

Two photos look the same until you search them for differences. A snapshot test saves a photo of a result. It compares every new result with that photo.

How it works

The compiler turns a program into simpler steps before it makes machine code. Snapshot tests save these steps for many small programs. When a change produces different steps, the test shows the difference. A person then decides if the new steps are correct.

Four kinds of computerone recipe, four kitchens

  • every push

A recipe that works in your kitchen can fail in another oven. So we cook it in four kitchens.

How it works

The tests run on Linux with Intel or AMD processors, on Linux with ARM processors, on Windows and on macOS. Each system handles files, threads and memory in its own way. A bug that hides on one system often shows on another.

Real databasesa test drive on real roads

  • every push

A driving simulator is useful, but a new car is also tested on real roads. Real roads have surprises that a simulator does not.

How it works

Novis works with five databases: PostgreSQL, MySQL, MariaDB, Microsoft SQL Server and SQLite. The tests start a real server for each one and run against it. The code that checks logins against a company directory (LDAP) is tested against a real directory server.

Editor teststhe helper in your editor, checked

  • every change
  • every push

Novis helps you while you type. It completes names, shows errors and explains code when you point at it. Editor tests check each of these answers.

How it works

Each of the at least 800 editor tests is a small file with a cursor position and the answer the editor must give. Other tests start the real VS Code extension and use it the way a person does. They run on Linux, Windows and macOS.

Novis is written in Rust, a language that prevents most memory errors. A few parts of Novis do work that Rust cannot check, such as running the machine code that Novis makes. These tools check those parts.

Fuzzingthe crash-test lab

  • every night

A crash-test lab throws thousands of objects at a car, from every angle. It keeps notes on the throws that found something new, and tries more throws like them.

How it works

A fuzzer sends random input to one part of Novis, as fast as it can. It sees which code each input reaches, and changes the inputs that reach new code. It runs on 26 parts, such as the parser and the code that reads requests, cookies, uploads, URLs, JSON and XML.

Each part gets five minutes every night. The fuzzer keeps its notes from night to night, so each night starts where the last one ended.

Mirithe driving instructor

  • every night

You drive home safely, but you went through a red light. Nothing happened this time. The driving instructor beside you still notices.

How it works

Miri runs Rust code very slowly, one step at a time. It checks every memory access against the rules of Rust. It finds code that breaks a rule but works today by luck. On another computer, or after a small change, the same code could crash or leak data.

Miri checks the parser, parts of the type checker, the runtime and the library.

AddressSanitizera tripwire around every box

  • every push
  • every night

In this warehouse, every box has a tripwire around it. Reach one centimetre past your own box, and the alarm goes off.

How it works

AddressSanitizer builds Novis with a guard area around every block of memory. A read or a write in a guard area stops the test with a report. It finds code that reads past the end of its memory, or uses memory after it was freed. It checks the runtime, the library and the code generator.

ThreadSanitizertwo hands on one cell

  • every push
  • every night

Two people change the same cell of a shared spreadsheet at the same moment. One of the two changes is lost, and nobody notices.

How it works

A web server does many things at the same time, on many threads. ThreadSanitizer records every memory access and the thread that made it. It reports two threads that use the same memory without waiting for each other. These bugs are rare and hard to repeat, and this tool sees them every time.

The unsafe code countthe rooms without safety rails

  • every night

In a factory, a few rooms have no safety rails, because the work there needs it. Each of these rooms has a sign that says why.

How it works

Rust can switch off some of its checks inside a block of code called unsafe. In 16 of the 23 parts of Novis, this is not allowed at all. In the other parts, each unsafe block has a written reason. Every night, a tool counts the unsafe code in each part, so any growth is easy to see.

The tests above use Novis the way it is meant to be used. These tests use it the way an attacker would.

Attack programsa burglar hired to test the locks

  • every push

Some companies hire a burglar to break into their own building. The test passes when every door holds.

How it works

Every feature of Novis has at least one attack program. It sends huge input, broken data or loops that never end. The test fails if Novis crashes, hangs or stops with an internal error. Each attack has 10 seconds.

Some attacks try something Novis must not allow, such as keeping data for the next request. They pass only when Novis stops the attempt and keeps running. There are at least 1,900 attack programs. Read that attack.

The second run in one processthe same room, the next guest

  • every push

A hotel cleans each room before the next guest arrives. Nothing from the last guest may be left behind: no note, no key, no towel.

How it works

Each Novis request starts with its own clean memory. To test this, most answer-key tests run a second time, one after another, in one shared process. Each test must print exactly what it printed alone. If a test left anything behind, the next test would see it, and its output would change. Read how isolation works.

The extension sandboxthe glovebox in a lab

  • every push

A chemist handles dangerous material inside a sealed box, through gloves. Whatever happens inside the box stays inside.

How it works

An extension adds functions to Novis, and it can be written in another language. Each extension runs inside a WebAssembly sandbox. Tests check that an extension can only reach the memory it was given. They also check that an endless loop is stopped, and that each run starts clean.

The dependency checkevery ingredient checked

  • every push
  • every night

A restaurant checks every ingredient it buys. Is it on a recall list? Does its label say what is inside?

How it works

Novis uses open-source libraries that other people write. A check tests each library against a public list of known security problems. It also checks each library’s licence. Libraries may only come from the official Rust registry, and a few are not allowed at all. For example, Novis does not use OpenSSL. For HTTPS, it uses a library written in Rust.

Rebuilt from sourcea second part from the blueprint

  • every push

To check a delivered part, a factory builds a second one from the blueprint. The two must be the same.

How it works

Novis includes the library for WebP images in compiled form. A check builds the library again from its source code. It compares the result with the copy in Novis, byte for byte. A copy that somebody changed would not match.

Novis exists to run web requests fast. These checks find a change that makes it slower.

Speed limitsa speed camera with a margin

  • every push

A speed camera does not flash at 51 in a 50 zone. It has a margin, so only a driver who is really too fast gets a ticket.

How it works

Some tests measure how much work Novis does, such as the work to start a program. Each test has two limits. Above the first limit, the test prints a warning. Above the second, much higher limit, the test fails. The margin keeps a busy test computer from failing a good change.

Growth laddersdoubling the dinner guests

  • by hand

Cooking for 8 guests should take about twice as long as cooking for 4. If it takes four times as long, something in the kitchen is wrong.

How it works

Every feature has a benchmark that runs with input of growing size, doubled at each step. A tool checks how the cost grows when the input doubles. A feature whose cost grows faster than its input, such as with its square, is not accepted. There are at least 1,900 benchmarks. We run the ladders by hand.

The load testrush hour

  • by hand

A road that is fine at noon can stop at rush hour. You only learn this by driving it at rush hour.

How it works

The load test sends a Novis server as many requests as it can answer. It checks every answer, and not only the speed. We run it by hand. We also run the same programs in other languages, on one machine. See the results.

A server runs for weeks. If each request leaves a little memory behind, the server slowly fills up and stops.

The soak testthe tap left running

  • every night

Leave a tap running into a basin with an open drain. If the water level stays the same all night, the drain works.

How it works

Every night, a test sends thousands of requests to one Novis server, on Linux, Windows and macOS. It measures the server’s memory after a warm-up, and again at the end. The memory must stay almost the same. If it grows, some request left memory behind.

Memory and time limitsa locker for each request

  • every change
  • every push

At a swimming pool, each guest gets a locker of the same size. A guest with too much luggage cannot take a second locker.

How it works

Each request has a memory limit and a time limit, which you set in nvs.toml. Tests check that a request over its limit stops, and that only that request stops. Other tests check that the memory a request uses is counted for that request. Read about limits.

Valgrindthe stock count

  • by hand

At the end of the day, a shop counts its stock. Everything that came in is sold or still on the shelf.

How it works

Valgrind runs a program and records every block of memory it takes and frees. At the end, it lists every block that was never freed. We run the examples and the attack programs under Valgrind, by hand, on Linux. It is slow, so it does not run in CI.

A test can pass and still miss a bug. These checks look for gaps in the tests themselves.

The coverage checkno empty box on the list

  • every change
  • every push

A checklist is only useful when every box is filled in. An empty box means a step that nobody did.

How it works

Every function in the Novis library must appear in at least three answer-key tests. A test fails when a function has fewer, so a new function cannot arrive without its tests. The editor tests have the same kind of list, with one box for each kind of editor request.

Feature proofsthe inspector's list

  • every push

A new building is finished when the inspector signs every item on the list. Doors that open are not enough.

How it works

A Novis feature is finished when it has six things. These are a page, tests in Novis and in Rust, three examples, a benchmark, an attack program and its help text. A check fails when a feature is missing one of them.

The fire drillbreaking things on purpose

  • by hand

A fire drill tests the alarm, not the fire. Somebody starts a pretend fire, and everybody checks that the alarm rings.

How it works

For a normal change, Novis runs only the tests that the change can reach. This is fast, but a wrong choice could skip a test that would fail. So we break Novis on purpose, in many small ways. For each break, the drill checks that the chosen tests include one that fails. We run the drill by hand.

Known problems, written downthe board on the wall

  • every push

A good workshop has a board with every known problem on it. Nothing is hidden in a drawer.

How it works

Sometimes an attack program or an example fails, and the fix takes longer. Then the problem is written down in a file in the repository. A check fails when a test fails without such a file. Each file says what fails and why. Read the list.

The manual is tested tooa manual with no wrong steps

  • every push

A manual with a wrong step is worse than no manual. So this website is checked like code.

How it works

Every code example on this website runs, and its output must match the output on the page. Every link must lead to a page that exists. A check also measures every sentence, and no sentence may have more than 25 words. When a feature changes, a check lists the pages about it, so somebody reads them again.

These are the gaps we know about.

  • An independent security audit. No outside company has reviewed Novis yet.
  • Property tests. A property test checks a general rule with many generated inputs. For example, sorting a list twice gives the same result as sorting it once. Novis has no property tests yet. Fuzzing covers some of the same ground.
  • Mutation testing. A mutation tool changes the code of Novis in many small ways. Each time, some test must fail. Novis has no such tool yet. The fire drill does this for the test selection only.
  • Some checks run only by hand. These are Valgrind, the growth ladders, the load test and the fire drill. They do not run in CI.