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

Add GitHub actions #2

Merged
merged 8 commits into from
Oct 1, 2023
Merged
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
2 changes: 2 additions & 0 deletions .github/workflow_build_windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
cl /std:c++20 /O2 /W4 /MT /arch:IA32 /utf-8 /permissive- /EHsc cachex.cpp
22 changes: 22 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: C++ CI (Linux)

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build-ubu:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Build with GCC
run: g++ -Wall -Wextra -std=c++20 cachex.cpp

- name: Build with Clang
run: clang++ -Wall -Wextra -std=c++20 cachex.cpp
20 changes: 20 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: C++ CI (Windows)

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build-win:
runs-on: windows-latest

steps:
- uses: actions/checkout@v1

- name: Build with MSVC
shell: cmd
run: .github/workflow_build_windows.bat
29 changes: 19 additions & 10 deletions cachex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,13 @@ CommandResult Read_D8h(long int TargetSector, int NbSectors, bool FUAbit)

struct sReadCommand
{
sReadCommand(const char *name, CommandResult (*func)(long int, int, bool),
bool fua)
: Name(name), pFunc(func), Supported(false), FUAbitSupported(fua)
{
}

sReadCommand &operator=(const sReadCommand &) = delete;
sReadCommand(const sReadCommand &) = delete;

const char *const Name;
Expand All @@ -400,13 +407,13 @@ struct sReadCommand
bool operator==(const char *name) const { return strcmp(Name, name) == 0; }
};

std::array<sReadCommand, 7> Commands = {{{"BEh", &Read_BEh, false, false},
{"A8h", &Read_A8h, false, true},
{"28h", &Read_28h, false, true},
{"28h_12", &Read_28h_12, false, true},
{"D4h", &Read_D4h, false, true},
{"D5h", &Read_D5h, false, true},
{"D8h", &Read_D8h, false, true}}};
std::array<sReadCommand, 7> Commands = {{{"BEh", &Read_BEh, false},
{"A8h", &Read_A8h, true},
{"28h", &Read_28h, true},
{"28h_12", &Read_28h_12, true},
{"D4h", &Read_D4h, true},
{"D5h", &Read_D5h, true},
{"D8h", &Read_D8h, true}}};

sReadCommand &GetSupportedCommand()
{
Expand Down Expand Up @@ -1047,7 +1054,9 @@ int TestCacheLineSize_Stat(sReadCommand &ReadCommand, long int TargetSector,
// find all values above 90% of max
Threshold = Maxdelay * ThresholdRatioMethod2;
for (int i = 1;
(i < NbMeasures) && (NbPeakMeasures < static_cast<int>(PeakMeasuresIndexes.size())); i++)
(i < NbMeasures) &&
(NbPeakMeasures < static_cast<int>(PeakMeasuresIndexes.size()));
i++)
{
if (Measures[i] > Threshold)
PeakMeasuresIndexes[NbPeakMeasures++] = i;
Expand Down Expand Up @@ -1417,12 +1426,12 @@ int main(int argc, char **argv)
int Nbtests = 0;
const char *UserReadCommand = nullptr;

// --------------- setup ---------------------------
// --------------- setup ---------------------------
std::cerr
<< "\nCacheExplorer 0.12 - https://github.com/xavery/cachex, based on";
std::cerr << "\nCacheExplorer 0.9 - spath@cdfreaks.com\n";

// ------------ command line parsing --------------
// ------------ command line parsing --------------
if (argc < 2)
{
PrintUsage();
Expand Down