blob: a3a1d9f0de492686bef90d3f3f0c1d2c67fffb1c [file] [log] [blame]
#include "flash-ipmi.hpp"
#include <cstdio>
#include <gtest/gtest.h>
#include <string>
#define THIRTYTWO_MIB 33554432
TEST(FlashIpmiHashStartTest, OutofSequenceFails)
{
// Verify that the image must be started first. (can change).
std::string name = std::tmpnam(nullptr);
std::string name2 = std::tmpnam(nullptr);
FlashUpdate updater(name, name2);
EXPECT_FALSE(updater.startHash(THIRTYTWO_MIB));
(void)std::remove(name.c_str());
(void)std::remove(name2.c_str());
}
TEST(FlashIpmiHashStartTest, VerifyHashFileCreated)
{
// Verify that it's happy.
std::string name = std::tmpnam(nullptr);
std::string name2 = std::tmpnam(nullptr);
FlashUpdate updater(name, name2);
EXPECT_TRUE(updater.start(THIRTYTWO_MIB));
EXPECT_TRUE(updater.startHash(THIRTYTWO_MIB));
(void)std::remove(name.c_str());
(void)std::remove(name2.c_str());
}