Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit-testing and general improvements. #29

Merged
merged 48 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
723d37e
intro(test & hamon): Begin implementing unit tests, make some big cha…
h4rldev Aug 11, 2024
1be4efa
Pin ci.yml's to commit hashes
h4rldev Aug 11, 2024
1050a74
fix(readme): Badger
h4rldev Aug 13, 2024
3cf2327
feat(test): don't include unity in repo any longer, pulls now from it…
h4rldev Aug 14, 2024
e0fce56
feat: Fixed major and minor bugs such as incorrect arg parsing and ar…
h4rldev Aug 31, 2024
2d1482e
clean: remove defaults.cfg as it's in the way
h4rldev Aug 31, 2024
46eac25
fix(tests) & feat: Unmessify cli.c aswell as finish test_builtins, wr…
h4rldev Aug 31, 2024
de7709d
feat(test & hamon): Implement environment variables and finalize test…
h4rldev Sep 4, 2024
87a7336
feat(test & hamon): Work on windows support
h4rldev Sep 4, 2024
888cffe
feat(hamon): Work on more windows support
h4rldev Sep 4, 2024
6d80fee
feat(hamon): Work on more windows support
h4rldev Sep 4, 2024
7789ca3
clean: remove weird log file
h4rldev Sep 4, 2024
ead10d5
feat: change some types around, this is literally a guessing game at …
h4rldev Sep 4, 2024
78b57fa
feat: change some types around once more
h4rldev Sep 4, 2024
10c31cc
feat: change some types around once more
h4rldev Sep 4, 2024
54fb58a
feat(build): see if -lbsd will work
h4rldev Sep 4, 2024
e474951
feat(build): add bsd include path
h4rldev Sep 4, 2024
e0fc387
fix(build): add missing space
h4rldev Sep 4, 2024
4ce0091
fix: Fix includes for windows I hope
h4rldev Sep 4, 2024
4e20879
fix: Fix includes for windows I fucking hope
h4rldev Sep 4, 2024
9c60388
fix: Fix includes for windows I fucking hope (x2222)
h4rldev Sep 4, 2024
014fde4
feat: attempting to fix path breaking and execve not working properly…
h4rldev Sep 4, 2024
a88ef3d
fix: fix execve, will work on a better tokenizer next.
h4rldev Sep 5, 2024
1e06403
Merge branch 'tatsoku:main' into main
h4rldev Sep 5, 2024
2767245
feat(repo) & fix(ci): Do a file structure change on the repo, aswell …
h4rldev Sep 5, 2024
1fda6ec
remove cache folder.
h4rldev Sep 5, 2024
d5c511d
feat(ci): add msys
h4rldev Sep 5, 2024
5ff74d9
feat(ci): run commands with msys
h4rldev Sep 5, 2024
f28c751
fix(ci): fix typo
h4rldev Sep 5, 2024
883d67c
fix(ci): ah yes, actions definitely make sense
h4rldev Sep 5, 2024
96d6351
fix(build): apply new include rule
h4rldev Sep 5, 2024
62fb5b5
fix(ci): follow the setup-msys2 docs for once
h4rldev Sep 5, 2024
44b9726
cope(ci): please work
h4rldev Sep 5, 2024
2d6d7eb
cope(ci): fix typo........................
h4rldev Sep 5, 2024
46ae667
cope(ci): use msys2 just installation
h4rldev Sep 5, 2024
7282e0f
cope(ci): make msys actually have clang
h4rldev Sep 5, 2024
d7adb64
cope(ci): use a later clang version
h4rldev Sep 5, 2024
d6e4e44
cope(ci): use the clang version for the env
h4rldev Sep 5, 2024
7e5f320
fix(test): make testing work with the changes aswell
h4rldev Sep 5, 2024
7580122
feat(build): add more verbosity
h4rldev Sep 5, 2024
a8d777c
fix(build): fix paths issue with compilation
h4rldev Sep 5, 2024
e68e0fb
feat(ci): update codeql workflow to use just and conform to the new s…
h4rldev Sep 5, 2024
9b6f49f
fix(just): make sure it conforms to the new project structure
h4rldev Sep 5, 2024
b209998
fix(exec): Fix bad address
h4rldev Sep 6, 2024
f442ab9
feat: It finally compiles, but it doesn't run.
h4rldev Sep 6, 2024
073404c
clean: remove shitty vscode file
h4rldev Sep 6, 2024
0e6973a
feat: Working on debugging for windows. WILL NOT debug any further 't…
h4rldev Sep 6, 2024
93187cd
fix: security in both prompt.c and build.sh, aswell as see that readi…
h4rldev Sep 8, 2024
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
2 changes: 2 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CompileFlags:
Add: [-Wall, -Wextra, -I./]
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: C Test CI
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Show resolved Hide resolved
github-advanced-security[bot] marked this conversation as resolved.
Show resolved Hide resolved
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Show resolved Hide resolved
h4rldev marked this conversation as resolved.
Dismissed
Show resolved Hide resolved
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
strategy:
matrix:
os: [ubuntu-24.04, windows-latest]
include:
- {sys: clang64, env: clang-x86_64}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install mold on ubuntu systems
if: matrix.os == 'ubuntu-24.04'
uses: rui314/setup-mold@2e332a0b602c2fc65d2d3995941b1b29a5f554a0 # v1
- name: Install msys-clang on windows systems.
if: matrix.os == 'windows-latest'
uses: msys2/setup-msys2@v2
Fixed Show fixed Hide fixed
h4rldev marked this conversation as resolved.
Show resolved Hide resolved
h4rldev marked this conversation as resolved.
Fixed
Show resolved Hide resolved
h4rldev marked this conversation as resolved.
Dismissed
Show resolved Hide resolved
with:
msystem: ${{ matrix.sys }}
install: |
libbsd
git
mingw-w64-${{matrix.env}}-just
mingw-w64-${{matrix.env}}-clang
- name: Install just on ubuntu
if: matrix.os == 'ubuntu-24.04'
uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2
- name: Test build on windows
if: matrix.os == 'windows-latest'
shell: msys2 {0}
run: just build
- name: Test build on ubuntu
if: matrix.os == 'ubuntu-24.04'
shell: bash
run: just build
- name: Run unit-tests on windows
if: matrix.os == 'windows-latest'
shell: msys2 {0}
run: just test
- name: Run unit-tests on ubuntu
if: matrix.os == 'ubuntu-24.04'
shell: bash
run: just test
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/bin/
/out/
/build/bin/
/build/out/
/build/tests/
/hsh
/hshell
/hamon
/tests/unity
/vgcore
/compile_commands.json
/.cache
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ repos:
hooks:
- id: clang-format
- id: clang-tidy
- id: oclint
- id: uncrustify
- id: cppcheck
- id: cpplint
- id: include-what-you-use
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.5)
project(hamon)

include_directories(include)

add_executable(main src/main.c)
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ or **H**amon **SH**ell aka hsh.
A homemade shell in C.

Compiled with
[clang](https://github.com/llvm/llvm-project/tree/main/clang) or
[clang](https://github.com/llvm/llvm-project/tree/main/clang) or
[gcc](https://gcc.gnu.org) & linked with [mold](https://github.com/rui314/mold).

![[LICENSE](https://github.com/h4rldev/hshell/blob/main/LICENSE)](https://img.shields.io/github/license/h4rldev/hshell?style=flat-square)
![[OpenSSF Scorecard](https://securityscorecards.dev/viewer/?uri=github.com/h4rldev/hshell)](https://api.securityscorecards.dev/projects/github.com/h4rldev/hshell/badge?style=flat-square)

<a href="https://github.com/tatsoku/hamon/blob/main/LICENSE">
Dismissed Show dismissed Hide dismissed
<img src="https://img.shields.io/github/license/tatsoku/hamon?style=flat-square"
Dismissed Show dismissed Hide dismissed
alt="License: BSD 3-Clause" />
</a>
<a href="https://securityscorecards.dev/viewer/?uri=github.com/tatsoku/hamon">
Dismissed Show dismissed Hide dismissed
<img src="https://api.securityscorecards.dev/projects/github.com/tatsoku/hamon/badge?style=flat-square"
Dismissed Show dismissed Hide dismissed
alt="OpenSSF Scorecard" />
</a>

> \[!NOTE\]
> This project is in no way functional yet!
Expand Down Expand Up @@ -53,7 +60,7 @@ chmod +x ./scripts/build.sh
./scripts/build.sh -l hsh
```

_et voilà!_ Now it should be located in ./bin/ aswell.
_et voilà!_ Now it should be located in ./bin/ aswell.

## Contributing

Expand All @@ -70,9 +77,9 @@ Such as:
Just don't clutter the repo with config files for your editor.

You will also need to either have a shell that supports bash scripts,
unless you want to port
[build.sh](https://github.com/tatsoku/hamon/blob/main/scripts/build.sh)
for Powershell or Batch,
unless you want to port
[build.sh](https://github.com/tatsoku/hamon/blob/main/scripts/build.sh)
for Powershell or Batch,
which is ick, but I'll gladly accept a pr for it.

Also, one final thing, make sure you have pre-commit hooks.
Expand Down
Loading
Loading