Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ mkfs/mkfs: mkfs/mkfs.c $K/fs.h $K/param.h
UPROGS=\
$U/_cat\
$U/_echo\
$U/_fnr\
$U/_forktest\
$U/_grep\
$U/_init\
Expand All @@ -128,13 +129,16 @@ UPROGS=\
$U/_rm\
$U/_sh\
$U/_stressfs\
$U/_test\
$U/_tolower\
$U/_tosh\
$U/_usertests\
$U/_grind\
$U/_wc\
$U/_zombie\

fs.img: mkfs/mkfs README.md $(UPROGS)
mkfs/mkfs fs.img README.md $(UPROGS)
mkfs/mkfs fs.img README.md input.txt append.txt test.sh tosh_test1.sh tosh_test2.sh tosh_test3.sh tosh_test4.sh $(UPROGS)

-include kernel/*.d user/*.d

Expand Down
75 changes: 74 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,77 @@
# FogOS
<h3 align="center" style="font-size: 2.1em; font-weight: bolder;">FogOS</h3>

<p align="center">
An Operating System Built on Top of Xv6
<br />
<a href="https://github.com/nestrada2/FogOS/tree/main/docs"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://github.com/nestrada2/FogOS/issues/new?labels=bug&template=bug-report.md">Report Bug</a>
·
<a href="https://github.com/nestrada2/FogOS/issues/new?labels=enhancement&template=feature-request.md">Request Feature</a>
</p>
</div>

<!-- ABOUT THE PROJECT -->
## 📖 About the Project
![FogOS](docs/fogos.gif)

This project builds on top of the foundational xv6 operating system, a teaching OS developed by MIT based on Unix Version 6, serving as a hands-on tool for understanding OS internals, experimenting with kernel-level programming, and exploring Unix-like system development in a manageable and accessible codebase.

### **✨ Features**
- [test: check file types and compare values](https://github.com/USF-OS/FogOS/pull/77)
- [tosh: command line shell](https://github.com/nestrada2/FogOS/blob/main/docs/TOSH.md)

### **🛠️ Tech Stack**
[![C][C.com]][C-url]
<br />
[![Unix-like][Unix-like.com]][Unix-like-url]
<br />
[![Xv6][Xv6.com]][Xv6-url]
<br />
[![Qemu][Qemu.com]][Qemu-url]
<br />

<!-- GETTING STARTED -->
## 📦 Getting Started

### **💾 Installation**
1. **Install QEMU**
<br />
QEMU is required to emulate and test FogOS on your local machine. https://www.qemu.org/download/
2. **Clone the repo**
```sh
git clone https://github.com/nestrada2/FogOS.git
```

### **▶️ Running the Program**
1. **Build FogOS**
```sh
make
```
2. **Run FogOS with QEMU**
```sh
make qemu
```

<!-- LICENSE -->
## 📜 License
Distributed under the xv6 License. See [`xv6-LICENSE`](xv6-LICENSE) for more information.

<!-- RESOURCES -->
## 📚 Resources
[Man](https://www.man7.org/linux/man-pages/index.html),
[QEMU](https://www.qemu.org/docs/master/),
[Stack Overflow](https://stackoverflow.com/),
[W3 School](https://www.w3schools.com/),
[Geeks for Geeks](https://www.geeksforgeeks.org/)

<!------- MARKDOWN LINKS & IMAGES ------->
[C.com]: https://img.shields.io/badge/C-00599C?style=for-the-badge&logo=c&logoColor=white
[C-url]: https://www.iso.org/standard/74528.html
[Unix-like.com]: https://img.shields.io/badge/Unix-like-4285F4?style=for-the-badge&logo=unix-like
[Unix-like-url]: #
[Xv6.com]: https://img.shields.io/badge/Xv6-100000?style=for-the-badge&logo=xv6
[Xv6-url]: https://pdos.csail.mit.edu/6.828/2012/xv6.html
[Qemu.com]: https://img.shields.io/badge/Qemu-EE0000?style=for-the-badge&logo=qemu
[Qemu-url]: https://www.qemu.org/
1 change: 1 addition & 0 deletions append.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello World! This is append.txt
58 changes: 58 additions & 0 deletions docs/TEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!-- COMMAND LOGO -->
<div align="center">
🧪
<h3 align="center" style="font-size: 2.1em; font-weight: bolder;">test</h3>

<p align="center">
Condition Evaluation Tool
<br />
<br />
<a href="https://github.com/nestrada2/FogOS/issues/new?labels=bug&template=bug-report.md">Report Bug</a>
·
<a href="https://github.com/nestrada2/FogOS/issues/new?labels=enhancement&template=feature-request.md">Request Feature</a>
</p>
</div>

<!-- ABOUT THE COMMAND -->
## 📖 About the Command
The `test` command evaluates a conditional expression. It is an if statement that will return zero (true), 1 (false), or greater than 1 (error). The `test` command will check if any flags were inputted and, based on the expression, will return a truthy or falsy value.

<!-- FILES ADDED -->
### **📁➕ Files Added**
user:
- test.c (new: call sys_open, pass a path to that and that will give us a file descriptor. With the file descriptor we call sys_fstat, and pass in the file descriptor, and a pointer to an empty stat struct which will be populated with the file's metadata)

<!-- FEATURES -->
### **✨ Expressions Implemented in Test**
| Command | Description |
| :---------: | :-----------: |
| -d file | True if file exists and is a directory. |
| -e file | True if file exists (regardless of type). |
| -f file | True if file exists and is a regular file. |
| file1 -ef file2 | True if file1 and file2 exist and refer to the same file. |
| s1 = s2 | True if the strings s1 and s2 are identical. |
| s1 != s2 | True if the strings s1 and s2 are not identical. |
| n1 -gt n2 | True if the integer n1 is algebraically greater than the integer n2. |
| n1 -lt n2 | True if the integer n1 is algebraically less than the integer n2. |

<!-- EXAMPLES -->
### **📋 Examples**
**Example 1: File Analysis**
* `test -f cat`
* Expected Output: 0

**Example 2: String Operators**
* `test "hello" = "hell"`
* Expected Output: 1

**Example 3: Number Operators**
* `test 23 -gt 32 `
* Expected Output: 1

<!-- TEST -->
### **🔬 Tests**
| Command | Description |
| :---------: | :-----------: |
| sh test.sh | Runs a series of automated tests to validate the behavior of the program. |

**⚠️ Note:** The test script only runs if you add shell scripting support.
Loading