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

Automate testing #335

Merged
merged 4 commits into from
Dec 15, 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
31 changes: 30 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,37 @@ jobs:
with:
name: build
path: .build/package/build/rmall/src/release
- name: Save repo
uses: actions/upload-artifact@v3
with:
name: repo
path: .build/package/dist/rmall
test:
name: Test packages
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/download-artifact@v3
id: download
with:
name: repo
- uses: Eeems-Org/run-in-remarkable-action@v1
with:
setup: |
set -ex
echo "src/gz local-rmall file:///opt/tmp/src" > /opt/etc/opkg.conf.d/16-local.conf
run: |
set -ex
echo Y | toltecctl generate-opkg-conf
opkg update
opkg install oxide
# systemctl disable --now xochitl
# systemctl enable --now tarnish
# TODO install and run tests
opkg remove --force-removal-of-dependent-packages liboxide
path: ${{ steps.download.outputs.download-path }}
release:
needs: build
needs: [build,test]
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
steps:
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ all: release

.NOTPARALLEL:

MAKEFLAGS := --jobs=$(shell nproc)

# FEATURES += sentry

DIST=$(CURDIR)/release
Expand All @@ -25,10 +27,10 @@ release: clean build $(RELOBJ)
mkdir -p $(DIST)
# Force liboxide makefile to regenerate so that install targets get when being build in toltecmk
cd $(BUILD)/oxide/shared/liboxide && make qmake
INSTALL_ROOT=$(DIST) $(MAKE) -C $(BUILD)/oxide install
INSTALL_ROOT=$(DIST) $(MAKE) --output-sync=target -C $(BUILD)/oxide install

build: $(BUILD) $(OBJ)
$(MAKE) -C $(BUILD)/oxide all
$(MAKE) --output-sync=target -C $(BUILD)/oxide all

package: REV="~r$(shell git rev-list --count HEAD).$(shell git rev-parse --short HEAD)"
package:
Expand Down
2 changes: 1 addition & 1 deletion applications/applications.pro
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ xdg-open.depends = system-service
gio.depends = system-service
xdg-settings.depends = system-service
xdg-icon-resource.depends = system-service
desktop-file-edit.depends = desktop-file-edit
desktop-file-edit.depends =
desktop-file-install.depends =
inject_evdev.depends =

Expand Down
2 changes: 2 additions & 0 deletions applications/launcher/appitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@ Application* AppItem::getApp(){
app = instance;
return app;
}

#include "moc_appitem.cpp"
2 changes: 2 additions & 0 deletions applications/launcher/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,97 +35,97 @@
auto configFile = getConfigFile();
return configFile != nullptr && configFile->exists();
}
void Controller::loadSettings(){
// If the config directory doesn't exist,
// then print an error and stop.
qDebug() << "parsing config file...";
if(configFileExists()){
auto configFile = getConfigFile();
if (!configFile->open(QIODevice::ReadOnly | QIODevice::Text)) {
qCritical() << "Couldn't read the config file. " << configFile->fileName();
return;
}
QTextStream in(configFile);
while (!in.atEnd()) {
QString line = in.readLine();
if(!line.startsWith("#") && !line.isEmpty()){
QStringList parts = line.split("=");
if(parts.length() != 2){
O_WARNING(" Wrong format on " << line);
continue;
}
QString lhs = parts.at(0).trimmed();
QString rhs = parts.at(1).trimmed();
if (booleanSettings.contains(lhs)){
auto property = lhs.toStdString();
auto value = rhs.toLower();
auto boolValue = value == "true" || value == "t" || value == "y" || value == "yes" || value == "1";
setProperty(property.c_str(), boolValue);
qDebug() << " " << (property + ":").c_str() << boolValue;
}else if(settings.contains(lhs)){
auto property = lhs.toStdString();
setProperty(property.c_str(), rhs);
qDebug() << " " << (property + ":").c_str() << rhs.toStdString().c_str();
}
}
}
configFile->close();
}
qDebug() << "Finished parsing config file.";
auto sleepAfter = systemApi->autoSleep();
qDebug() << "Automatic sleep" << sleepAfter;
setAutomaticSleep(sleepAfter);
setSleepAfter(sleepAfter);
auto lockOnSuspend = systemApi->lockOnSuspend();
qDebug() << "Lock on suspend" << lockOnSuspend;
setLockOnSuspend(lockOnSuspend);
auto autoLock = systemApi->autoLock();
qDebug() << "Automatic lock" << autoLock;
setAutomaticLock(autoLock);
setLockAfter(autoLock);
for(short i = 1; i <= 4; i++){
setSwipeLength(i, systemApi->getSwipeLength(i));
}
qDebug() << "Updating UI with settings from config file...";
// Populate settings in UI
QObject* columnsSpinBox = root->findChild<QObject*>("columnsSpinBox");
if(!columnsSpinBox){
qDebug() << "Can't find columnsSpinBox";
}else{
columnsSpinBox->setProperty("value", columns());
}
QObject* sleepAfterSpinBox = root->findChild<QObject*>("sleepAfterSpinBox");
if(!sleepAfterSpinBox){
qDebug() << "Can't find sleepAfterSpinBox";
}else{
sleepAfterSpinBox->setProperty("value", this->sleepAfter());
}
QObject* swipeLengthRightSpinBox = root->findChild<QObject*>("swipeLengthRightSpinBox");
if(!swipeLengthRightSpinBox){
qDebug() << "Can't find swipeLengthRightSpinBox";
}else{
swipeLengthRightSpinBox->setProperty("value", this->swipeLengthRight());
}
QObject* swipeLengthLeftSpinBox = root->findChild<QObject*>("swipeLengthLeftSpinBox");
if(!swipeLengthLeftSpinBox){
qDebug() << "Can't find swipeLengthLeftSpinBox";
}else{
swipeLengthLeftSpinBox->setProperty("value", this->swipeLengthLeft());
}
QObject* swipeLengthUpSpinBox = root->findChild<QObject*>("swipeLengthUpSpinBox");
if(!swipeLengthUpSpinBox){
qDebug() << "Can't find swipeLengthUpSpinBox";
}else{
swipeLengthUpSpinBox->setProperty("value", this->swipeLengthUp());
}
QObject* swipeLengthDownSpinBox = root->findChild<QObject*>("swipeLengthDownSpinBox");
if(!swipeLengthDownSpinBox){
qDebug() << "Can't find swipeLengthDownSpinBox";
}else{
swipeLengthDownSpinBox->setProperty("value", this->swipeLengthDown());
}
qDebug() << "Finished updating UI.";
}

Check notice on line 128 in applications/launcher/controller.cpp

View check run for this annotation

codefactor.io / CodeFactor

applications/launcher/controller.cpp#L38-L128

Complex Method
void Controller::saveSettings(){
qDebug() << "Saving configuration...";
QSet<QString> items = settings;
Expand Down Expand Up @@ -299,7 +299,7 @@
std::string Controller::exec(const char* cmd) {
std::array<char, 128> buffer;
std::string result;
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd, "r"), pclose);

Check warning on line 302 in applications/launcher/controller.cpp

View check run for this annotation

codefactor.io / CodeFactor

applications/launcher/controller.cpp#L302

Possible OS Command Injection (CWE-78) (flawfinder7-execl)
if (!pipe) {
throw std::runtime_error("popen() failed!");
}
Expand Down Expand Up @@ -415,3 +415,5 @@
qDebug() << "Lock After: " << lockAfter << " minutes";
emit lockAfterChanged(m_lockAfter);
}

#include "moc_controller.cpp"
2 changes: 2 additions & 0 deletions applications/system-service/apibase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ int APIBase::hasPermission(QString permission, const char* sender){
qDebug() << "app not found, permission granted";
return true;
}

#include "moc_apibase.cpp"
2 changes: 2 additions & 0 deletions applications/system-service/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}
updateEnvironment();
umountAll();
if(chroot()){

Check notice on line 55 in applications/system-service/application.cpp

View check run for this annotation

codefactor.io / CodeFactor

applications/system-service/application.cpp#L55

Execution with unnecessary privileges (CWE-250, CWE-22) (flawfinder7-chroot)
mountAll();
m_process->setChroot(chrootPath());
m_process->setWorkingDirectory(chrootPath() + "/" + workingDirectory());
Expand Down Expand Up @@ -554,3 +554,5 @@
}
span = Oxide::Sentry::start_span(transaction, operation, description);
}

#include "moc_application.cpp"
2 changes: 2 additions & 0 deletions applications/system-service/appsapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,5 @@ void AppsAPI::ensureForegroundApp() {
}
});
}

#include "moc_appsapi.cpp"
2 changes: 2 additions & 0 deletions applications/system-service/bss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ QDBusObjectPath BSS::network(){
}

bool BSS::hasPermission(QString permission, const char* sender){ return wifiAPI->hasPermission(permission,sender); }

#include "moc_bss.cpp"
2 changes: 2 additions & 0 deletions applications/system-service/buttonhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,5 @@ void ButtonHandler::pressKey(Qt::Key key){
}
press_button(buttons, code, &stream);
}

#include "moc_buttonhandler.cpp"
2 changes: 2 additions & 0 deletions applications/system-service/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ QList<QDBusObjectPath> Network::bSSs(){
}

bool Network::hasPermission(QString permission, const char* sender){ return wifiAPI->hasPermission(permission, sender); }

#include "moc_network.cpp"
2 changes: 2 additions & 0 deletions applications/system-service/notification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,5 @@ void Notification::setIcon(QString icon){
}

bool Notification::hasPermission(QString permission, const char* sender){ return notificationAPI->hasPermission(permission, sender); }

#include "moc_notification.cpp"
2 changes: 2 additions & 0 deletions applications/system-service/screenapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ QDBusObjectPath ScreenAPI::screenshot(){
return path;
});
}

#include "moc_screenapi.cpp"
2 changes: 2 additions & 0 deletions applications/system-service/screenshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
#include"screenapi.h"

bool Screenshot::hasPermission(QString permission, const char* sender){ return screenAPI->hasPermission(permission, sender); }

#include "moc_screenshot.cpp"
2 changes: 2 additions & 0 deletions applications/system-service/systemapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,5 @@ void SystemAPI::toggleSwipes(){
notification->setText(message);
notification->display();
}

#include "moc_systemapi.cpp"
2 changes: 2 additions & 0 deletions applications/system-service/wlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
std::string Wlan::exec(QString cmd) {
std::array<char, 128> buffer;
std::string result;
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.toStdString().c_str(), "r"), pclose);

Check warning on line 59 in applications/system-service/wlan.cpp

View check run for this annotation

codefactor.io / CodeFactor

applications/system-service/wlan.cpp#L59

Possible OS Command Injection (CWE-78) (flawfinder7-execl)
if (!pipe) {
throw std::runtime_error("popen() failed!");
}
Expand All @@ -65,3 +65,5 @@
}
return result;
}

#include "moc_wlan.cpp"
1 change: 1 addition & 0 deletions applications/system-service/wpa_supplicant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ FiW1Wpa_supplicant1NetworkInterface::~FiW1Wpa_supplicant1NetworkInterface()
{
}

#include "moc_wpa_supplicant.cpp"
2 changes: 2 additions & 0 deletions applications/task-switcher/appitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ Application* AppItem::getApp(){
app = instance;
return app;
}

#include "moc_appitem.cpp"
2 changes: 2 additions & 0 deletions shared/liboxide/eventfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,5 @@ namespace Oxide{
return filtered;
}
}

#include "moc_eventfilter.cpp"
2 changes: 2 additions & 0 deletions shared/liboxide/liboxide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,5 @@ namespace Oxide {
O_SETTINGS_PROPERTY_BODY(SharedSettings, QString, Lockscreen, onLogin)
O_SETTINGS_PROPERTY_BODY(SharedSettings, QString, Lockscreen, onFailedLogin)
}

#include "moc_liboxide.cpp"
2 changes: 2 additions & 0 deletions shared/liboxide/settingsfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,5 @@ namespace Oxide {
return property(propertyName.toStdString().c_str()).toString();
}
}

#include "moc_settingsfile.cpp"
2 changes: 2 additions & 0 deletions shared/liboxide/signalhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,5 @@ namespace Oxide {
snUsr2->setEnabled(true);
}
}

#include "moc_signalhandler.cpp"
Binary file not shown.
36 changes: 36 additions & 0 deletions shared/sentry/src/external/crashpad/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
SHELL := /bin/bash
PATH := $(PWD)/../depot_tools:$(PATH)

all:
echo 'Nothing to do' && exit 1

build-with-gn:
gn gen out/Default
ninja -C out/Default
.PHONY: build-with-gn

build-with-cmake:
mkdir -p cmakebuild
cd cmakebuild; cmake ..
cmake --build cmakebuild --parallel
.PHONY: build-with-cmake

update-with-gclient:
gclient sync
.PHONY: update-with-gclient

example: build-with-gn
g++ -g \
-o example example.cpp \
-I. -I./third_party/mini_chromium/mini_chromium \
-std=c++14 \
-L./out/Default/obj/client -lclient \
-L./out/Default/obj/util -lutil \
-L./out/Default/obj/third_party/mini_chromium/mini_chromium/base -lbase \
-framework Foundation -framework Security -framework CoreText \
-framework CoreGraphics -framework IOKit -lbsm
.PHONY: example

gen-sentry-patch:
git format-patch --stdout master...HEAD > getsentry.patch
.PHONY: get-sentry-patch
49 changes: 49 additions & 0 deletions shared/sentry/src/external/crashpad/third_party/libfuzzer/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2018 The Crashpad Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

source_set("libfuzzer") {
if (crashpad_use_libfuzzer) {
sources = [
"src/FuzzerClangCounters.cpp",
"src/FuzzerCrossOver.cpp",
"src/FuzzerDriver.cpp",
"src/FuzzerExtFunctionsDlsym.cpp",
"src/FuzzerExtFunctionsDlsymWin.cpp",
"src/FuzzerExtFunctionsWeak.cpp",
"src/FuzzerExtFunctionsWeakAlias.cpp",
"src/FuzzerExtraCounters.cpp",
"src/FuzzerIO.cpp",
"src/FuzzerIOPosix.cpp",
"src/FuzzerIOWindows.cpp",
"src/FuzzerLoop.cpp",
"src/FuzzerMain.cpp",
"src/FuzzerMerge.cpp",
"src/FuzzerMutate.cpp",
"src/FuzzerSHA1.cpp",
"src/FuzzerShmemPosix.cpp",
"src/FuzzerShmemWindows.cpp",
"src/FuzzerTracePC.cpp",
"src/FuzzerUtil.cpp",
"src/FuzzerUtilDarwin.cpp",
"src/FuzzerUtilLinux.cpp",
"src/FuzzerUtilPosix.cpp",
"src/FuzzerUtilWindows.cpp",
]

configs -= [
"//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors",
"//build:crashpad_fuzzer_flags",
]
}
}
2 changes: 1 addition & 1 deletion web/src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ Uninstall Oxide

1. ``systemctl disable --now tarnish``
2. ``systemctl enable --now xochitl``
3. ``opkg remove -force-removal-of-dependent-packages liboxide``
3. ``opkg remove --force-removal-of-dependent-packages liboxide``